From 79af9ebe91e5596aed83965b3fdce593b43161e3 Mon Sep 17 00:00:00 2001 From: Nora Mehesz Date: Mon, 30 Oct 2023 22:18:32 +0100 Subject: [PATCH] Set host in opts --- marketdata/rest.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/marketdata/rest.go b/marketdata/rest.go index 370b534..6522f45 100644 --- a/marketdata/rest.go +++ b/marketdata/rest.go @@ -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. @@ -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)