-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cache): set content length for put artifact (#9183)
### Description Fixes #9177 In #8081 we changed from setting the body of our `PUT` requests from a vec of bytes to a stream of bytes. This results in the underlying `hyper` request having a body with `Kind::Wrapped` instead of `Kind::Once`. This results in the body no longer having an [exact length](https://github.com/hyperium/hyper/blob/0.14.x/src/body/body.rs#L437). With the body no longer having an exact length, `hyper` would no longer set `Content-Length` for us [source](https://github.com/hyperium/hyper/blob/0.14.x/src/proto/h2/client.rs#L377). This PR explicitly sets the content length header. It would be nice if we could set the length on the body itself, but `hyper` doesn't allow for this flexibility. (We cannot simply implement a size hint on `UploadProgress`, but the size hint should return the size of the stream, not the number of bytes in the stream) ### Testing Instructions Added an assertion on the mock `PUT /artifacts` endpoint to make sure that `Content-Length` gets set.
- Loading branch information
1 parent
0c34728
commit dfe3ca2
Showing
6 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters