Skip to content

Commit

Permalink
add language version to header and handle nil body (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenny-statsig authored Mar 8, 2024
1 parent 2a61098 commit 031e79c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func (transport *transport) buildRequest(method, endpoint string, body interface
return nil, err
}
bodyBuf = bytes.NewBuffer(bodyBytes)
} else {
if method == "POST" {
bodyBuf = bytes.NewBufferString("{}")
}
}
req, err := http.NewRequest(method, transport.buildURL(endpoint), bodyBuf)
if err != nil {
Expand All @@ -121,6 +125,7 @@ func (transport *transport) buildRequest(method, endpoint string, body interface
req.Header.Add("STATSIG-SERVER-SESSION-ID", transport.metadata.SessionID)
req.Header.Add("STATSIG-SDK-TYPE", transport.metadata.SDKType)
req.Header.Add("STATSIG-SDK-VERSION", transport.metadata.SDKVersion)
req.Header.Add("STATSIG-SDK-LANGUAGE-VERSION", transport.metadata.LanguageVersion)
return req, nil
}

Expand Down

0 comments on commit 031e79c

Please sign in to comment.