Skip to content

api: add Client.NewHTTPRequest

Warren Gifford requested to merge k/new-http-request into master

Created by: keegancsmith

I want to make authenticated requests against the Sourcegraph API which are not via GraphQL. In particular I am experimenting with Server Sent Events endpoint. This commit adds NewHTTPRequest to the Client interface, which allows access to an authenticated http.Request. This will then be used to communicate with the non-GraphQL endpoint.

I have no idea if this fits your vision for the api package. After a little thought this seemed like the cleanest way to achieve this access, but I'm not a big fan of expanding interfaces.

Side-note: We could avoid adding to both interface and impl if this package returned a Client struct (but still kept the Request interface). The call sites could then use an interface for Client to make them testable.

Merge request reports

Loading