Skip to content

Commit

Permalink
Calculate OktaClient Content-Length correctly
Browse files Browse the repository at this point in the history
Previously the content length was being calculated based off of an empty
uninitialised byte array. With this change it's now calculated off of the
actual data array used as the body.

Setting the content length to 0 seemed to be causing an issue with
recent changes to Okta's infrastructure as noticed in segmentio#298.
  • Loading branch information
Will Gardner committed Sep 30, 2020
1 parent 98c40a4 commit eed1bc1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/okta.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ func GetFactorId(f *OktaUserAuthnFactor) (id string, err error) {

func (o *OktaClient) Get(method string, path string, data []byte, recv interface{}, format string) (err error) {
var res *http.Response
var body []byte
var header http.Header
var client http.Client

Expand Down Expand Up @@ -596,7 +595,7 @@ func (o *OktaClient) Get(method string, path string, data []byte, recv interface
ProtoMinor: 1,
Header: header,
Body: ioutil.NopCloser(bytes.NewReader(data)),
ContentLength: int64(len(body)),
ContentLength: int64(len(data)),
}

if res, err = client.Do(req); err != nil {
Expand Down

0 comments on commit eed1bc1

Please sign in to comment.