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
…#8)

Related: 

- Issue in the upstream repo: goccy#290
- PR in the upstream repo: goccy#338
  • Loading branch information
myhau authored Jul 15, 2024
1 parent ea0d66a commit a6cbaab
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 @@ -54,8 +54,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 a6cbaab

Please sign in to comment.