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

Add context expiration cancellation support #86

Merged

Conversation

wfscot
Copy link
Contributor

@wfscot wfscot commented May 28, 2021

Add support for expired and cancelled contexts, both with and without delay operations. This should make the behavior of gock mocks more similar to actual HTTP upstreams using the standard HTTP client.

Note that this change fundamentally requires go version 1.13 or greater. As such, go.mod was updated accordingly.

Resolves #84

This should make gock behave the same as the standard HTTP client when
it comes to request context behavior.
http.NewRequestWithContext was introduced in go v1.13 so that is now the
minimum required version. Also remove unused modules via go mod tidy.
@h2non
Copy link
Owner

h2non commented May 30, 2021

Thanks! Would you mind fixing the formatting issue?

https://travis-ci.org/github/h2non/gock/jobs/772774065#L283-L322

@wfscot
Copy link
Contributor Author

wfscot commented Jun 1, 2021

Done. Sorry about that. Let me know if you need anything else.

@h2non h2non merged commit d6983ca into h2non:master Jun 2, 2021
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.

Are you open to adding context expiration/cancellation support?
2 participants