File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -55,19 +55,28 @@ func GraphQLEndpoint(hostname string) string {
5555 if IsEnterprise (hostname ) {
5656 return fmt .Sprintf ("https://%s/api/graphql" , hostname )
5757 }
58+ if strings .EqualFold (hostname , localhost ) {
59+ return fmt .Sprintf ("http://api.%s/graphql" , hostname )
60+ }
5861 return fmt .Sprintf ("https://api.%s/graphql" , hostname )
5962}
6063
6164func RESTPrefix (hostname string ) string {
6265 if IsEnterprise (hostname ) {
6366 return fmt .Sprintf ("https://%s/api/v3/" , hostname )
6467 }
68+ if strings .EqualFold (hostname , localhost ) {
69+ return fmt .Sprintf ("http://api.%s/" , hostname )
70+ }
6571 return fmt .Sprintf ("https://api.%s/" , hostname )
6672}
6773
6874func GistPrefix (hostname string ) string {
6975 if IsEnterprise (hostname ) {
7076 return fmt .Sprintf ("https://%s/gist/" , hostname )
7177 }
78+ if strings .EqualFold (hostname , localhost ) {
79+ return fmt .Sprintf ("http://%s/gist/" , hostname )
80+ }
7281 return fmt .Sprintf ("https://gist.%s/" , hostname )
7382}
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ func TestGraphQLEndpoint(t *testing.T) {
147147 },
148148 {
149149 host : "github.localhost" ,
150- want : "https ://api.github.localhost/graphql" ,
150+ want : "http ://api.github.localhost/graphql" ,
151151 },
152152 {
153153 host : "ghe.io" ,
@@ -174,7 +174,7 @@ func TestRESTPrefix(t *testing.T) {
174174 },
175175 {
176176 host : "github.localhost" ,
177- want : "https ://api.github.localhost/" ,
177+ want : "http ://api.github.localhost/" ,
178178 },
179179 {
180180 host : "ghe.io" ,
You can’t perform that action at this time.
0 commit comments