Skip to content

Commit

Permalink
fix: set request content-type based on payload
Browse files Browse the repository at this point in the history
Only set the "Content-Type" of a request to "application/json" only if
the request includes a body. This ensures the "Content-Type" is
appropriate for the request and is interpretted correctly by the API.

Signed-off-by: Jacob Hull <[email protected]>
  • Loading branch information
jakedipity committed Jan 12, 2023
1 parent 6528dbc commit 4f5a8f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion logdna/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func newRequestConfig(pc *providerConfig, method string, uri string, body interf
}

func (c *requestConfig) MakeRequest() ([]byte, error) {
payloadBuf := bytes.NewBuffer([]byte{})
var payloadBuf io.Reader
if c.body != nil {
pbytes, err := c.jsonMarshal(c.body)
if err != nil {
Expand Down

0 comments on commit 4f5a8f2

Please sign in to comment.