samjtro / schwab

⚡ fast unofficial schwab traderapi hook
https://pkg.go.dev/github.com/samjtro/schwab
GNU General Public License v2.0
3 stars 0 forks source link

schwab-bug@accounts-trading.go/Submit() #59

Open samjtro opened 6 days ago

samjtro commented 6 days ago

what happened?

attempting to submit orders created locally to Schwab's API. this requires setting two headers:

Bearer token authorization is required for every request, and is handled through utils.go/Handler(), which obviously works for all other requests.

however, when attempting to set both Content-Type & Authorization, i receive an error depending on which I set first.

if i set Content-Type first, i receive an error 400 - unauthorized; if i set Authorization first, i receive an error 415 - invalid content type.

this behavior persists with the setters req.Header.Add as well as req.Header.Set, as well as attempting to set the header exclusively in accounts-trading.go/Submit with req.Header = http.Header...

what did you expect to happen?

no errors when setting multiple headers.