Skip to content

Commit

Permalink
add handler for new discovery endpoint so that CLI tools like bq work…
Browse files Browse the repository at this point in the history
… (fix for #290) (#338)
  • Loading branch information
myhau authored Aug 3, 2024
1 parent 58f8350 commit dc038eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func encodeResponse(ctx context.Context, w http.ResponseWriter, response interfa
}

const (
discoveryAPIEndpoint = "/discovery/v1/apis/bigquery/v2/rest"
uploadAPIEndpoint = "/upload/bigquery/v2/projects/{projectId}/jobs"
discoveryAPIEndpoint = "/discovery/v1/apis/bigquery/v2/rest"
newDiscoveryAPIEndpoint = "/$discovery/rest"
uploadAPIEndpoint = "/upload/bigquery/v2/projects/{projectId}/jobs"
)

//go:embed resources/discovery.json
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func New(storage Storage) (*Server, error) {
r.Handle(fmt.Sprintf("/bigquery/v2%s", handler.Path), handler.Handler).Methods(handler.HTTPMethod)
}
r.Handle(discoveryAPIEndpoint, newDiscoveryHandler(server)).Methods("GET")
r.Handle(newDiscoveryAPIEndpoint, newDiscoveryHandler(server)).Methods("GET")
r.Handle(uploadAPIEndpoint, &uploadHandler{}).Methods("POST")
r.Handle(uploadAPIEndpoint, &uploadContentHandler{}).Methods("PUT")
r.PathPrefix("/").Handler(&defaultHandler{})
Expand Down

0 comments on commit dc038eb

Please sign in to comment.