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

Fix idempotency key check when using automatic retries #642

Merged
merged 1 commit into from
Apr 26, 2019
Merged

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe @remi-stripe
cc @stripe/api-libraries

When using automatic retries, CurlClient overwrites the existing idempotency key because $headers is a list of strings and not a map of key/values. This PR fixes it by adding a hasHeader helper method to check if a list of headers already has a specific header.

Fixes #637.

No tests because CurlClient is ~impossible to test :(

}

return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor but isn't this quite slow/overhead? Should we maybe store "this information" (the fact that we set an idempotency key) elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really possible without modifying ClientInterface unfortunately.

Copy link
Contributor

@brandur-stripe brandur-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man, so crazy that this didn't throw an error of any kind before. Thanks for the quick fix!

@ob-stripe ob-stripe merged commit f66e911 into master Apr 26, 2019
@ob-stripe ob-stripe deleted the ob-DX-3870 branch April 26, 2019 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using network retries causes client defined Idempotency Key to be over written
4 participants