Added specification of Content-Length during creation of the Request Body for URL Encoded and JSON Encoded content.
The existing implementation uses the ioutil.NopCloser method to create the Request body, which triggers ShouldSendChunkedRequestBody in https://go.dev/src/net/http/transfer.go that results in the Request Header specifying Transfer-Encoding: Chunked.
This change enables compatibility with Endpoints (such as Microsoft Graph APIs) that do not support Transfer-Encoding: Chunked
Testing: I've rebuilt the new http.go library into the Pixlet application: https://github.com/tidbyt/pixlet and hit multiple endpoints at Google and MSFT cloud with successful result (about 10 different API calls)
Added specification of Content-Length during creation of the Request Body for URL Encoded and JSON Encoded content.
The existing implementation uses the ioutil.NopCloser method to create the Request body, which triggers ShouldSendChunkedRequestBody in https://go.dev/src/net/http/transfer.go that results in the Request Header specifying Transfer-Encoding: Chunked.
This change enables compatibility with Endpoints (such as Microsoft Graph APIs) that do not support Transfer-Encoding: Chunked
Testing: I've rebuilt the new http.go library into the Pixlet application: https://github.com/tidbyt/pixlet and hit multiple endpoints at Google and MSFT cloud with successful result (about 10 different API calls)