Previously, the spin_sdk.http.send function automatically added a content-length header to the header dictionary supplied by the caller if one was not already present and if a request body was specified. However, since we were mutating the dictionary in-place, the change was visible to the caller. In addition to being potentially surprising to the caller, that can lead to issues if the same object is reused for another request later, at which point the header we added earlier will still be present but not necessarily accurate for the new request.
To avoid such confusion, we now make a copy and add the content-length header to the copy.
Previously, the
spin_sdk.http.send
function automatically added acontent-length
header to the header dictionary supplied by the caller if one was not already present and if a request body was specified. However, since we were mutating the dictionary in-place, the change was visible to the caller. In addition to being potentially surprising to the caller, that can lead to issues if the same object is reused for another request later, at which point the header we added earlier will still be present but not necessarily accurate for the new request.To avoid such confusion, we now make a copy and add the
content-length
header to the copy.