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

Encode Query timeout header correctly #127

Merged
merged 3 commits into from
Jun 29, 2023
Merged

Conversation

ptpaterson
Copy link
Contributor

@ptpaterson ptpaterson commented Jun 28, 2023

Ticket(s): BT-3997

fixes #126

Problem

When the query_timeout option is provided to the client configuration, the X-Query-Timeout-Ms header gets encoded as a decimal. e.g. "5000.0" instead of "5000". Fauna returns a 400 error when this happens.

Solution

Make sure that the header is encoded as an integer.

We did this for when the query timeout is configured in QueryOptions (see #124), but we didn't cover the client config path.

Add test coverage for configuring and actually sending a request.

Result

Clients can be configured with query_timeout and Fauna will respect it.

Testing

Added a test to actually send requests with a client configured with query_timeout. One request with client config and one request with no client config but with QueryOptions.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pnwpedro pnwpedro force-pushed the query-timeout-client-config branch from 3864796 to e629c04 Compare June 29, 2023 10:05
@pnwpedro pnwpedro merged commit e7296c6 into main Jun 29, 2023
@pnwpedro pnwpedro deleted the query-timeout-client-config branch June 29, 2023 10:08
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.

Client query_timeout leads to 400 invalid request error
2 participants