Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop retriable request from adding a non-nil Body #726

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

chrisst
Copy link
Contributor

@chrisst chrisst commented Aug 30, 2023

When azure is responding with an error the retriable request that is generated ends up getting a non nil noOpcloser added to it with a reader interface. Ultimately this ends up sending a GET request to Azure that has a post body. As the http spec says that the body SHOULD be ignored this is not a critical error, but for people using custom transports this is problematic. It's also sending unnecessary bytes.

Example of the request being sent with an initial request: Body:{} GetBody:<nil>
This is the body when the same request is then retried: Body:{Reader:} GetBody:<nil>

I attempted to write a test for this but it turns out much of the test suite is leveraging GET with bodies in them. Inserting an error into the mocks for GET's with non-nil and non-empty request bodies broke a number of assumptions within the test framework. So I didn't end up adding an explicit test for this situation. The test suite does cover these lines already with unit tests to some degree and they are all still passing. I verified this locally with manual testing to confirm that

Thank you for your contribution to Go-AutoRest! We will triage and review it as soon as we can.

As part of submitting, please make sure you can make the following assertions:

  • I've tested my changes, adding unit tests if applicable.
  • I've added Apache 2.0 Headers to the top of any new source files.

Sorry, something went wrong.

When azure is responding with an error the retriable request that is generated ends up getting a non nil noOpcloser added to it with a reader interface. Ultimately this ends up sending a GET request to Azure that has a post body. As the http spec says that the body SHOULD be ignored this is not a critical error, but for people using custom transports this is problematic. It's also sending unessecary bytes.
@chrisst
Copy link
Contributor Author

chrisst commented Aug 30, 2023

@microsoft-github-policy-service agree company="Google"

@jhendrixMSFT jhendrixMSFT merged commit df94ce5 into Azure:main Sep 5, 2023
lvxiafei pushed a commit to lvxiafei/go-autorest that referenced this pull request Nov 17, 2023
When azure is responding with an error the retriable request that is generated ends up getting a non nil noOpcloser added to it with a reader interface. Ultimately this ends up sending a GET request to Azure that has a post body. As the http spec says that the body SHOULD be ignored this is not a critical error, but for people using custom transports this is problematic. It's also sending unessecary bytes.
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.

None yet

2 participants