Skip to content

Commit

Permalink
Set host in opts
Browse files Browse the repository at this point in the history
  • Loading branch information
noramehesz committed Oct 30, 2023
1 parent 7d04fa9 commit 79af9eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions marketdata/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type ClientOpts struct {
Currency string
// HTTPClient to be used for each http request.
HTTPClient *http.Client
// Host used to set the http request's host
RequestHost string
}

// Client is the alpaca marketdata Client.
Expand Down Expand Up @@ -89,6 +91,9 @@ var DefaultClient = NewClient(ClientOpts{})

func defaultDo(c *Client, req *http.Request) (*http.Response, error) {
req.Header.Set("User-Agent", alpaca.Version())
if c.opts.RequestHost != "" {
req.Host = c.opts.RequestHost
}

if c.opts.OAuth != "" {
req.Header.Set("Authorization", "Bearer "+c.opts.OAuth)
Expand Down

0 comments on commit 79af9eb

Please sign in to comment.