Skip to content

Conversation

@ruudk
Copy link

@ruudk ruudk commented Nov 8, 2024

Issue #, if available:
#225

Description of changes:
The problem is the the sign method in ProxyClient reads the req.Body and that results in a closed reader.

When the request is actually send to the transport later, the body cannot be read and results in a body length of 0 which does not match the passed req.ContentLength.

We tried to write tests for this, but the tests are not fully matching the real world because:

  • they use io.NopCloser
  • they use a HTTP mock client that doesn't actually read the body to send to the proxy (makes sense, its a mock, but it's different than the actual implementation)

If you have advice how to test this properly, we're all ears.

Fixes awslabs#225

The problem is the the `sign` method in ProxyClient reads the `req.Body` and that results
in a closed reader.

When the request is actually send to the transport later, the body cannot be read and results
in a body length of 0 which does not match the passed req.ContentLength.

We tried to write tests for this, but the tests are not fully matching the real world because:
* they use io.NopCloser
* they use a HTTP mock client that doesn't actually read the body to send to the proxy (makes sense,
its a mock, but it's different than the actual implementation)
@ruudk
Copy link
Author

ruudk commented Nov 8, 2024

@roystchiang @rapphil Could you please approve the workflow? If you have time, please advice how to write tests for this.

@ruudk ruudk closed this Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant