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 backwards compatible type params for HTTPRequest and HTTPStreamRequest #289

Closed
wants to merge 1 commit into from

Conversation

ecooper
Copy link
Contributor

@ecooper ecooper commented Oct 7, 2024

Data types for HTTPRequest and HTTPStreamRequest are hardcoded today. Because of #288, we need to support generics for data. They default to backwards compatible types.

Description

This PR makes the following backwards compatible changes:

  • HTTPRequest now takes a type parameter that is applied to data. It defaults to QueryRequest.
  • HTTPStreamRequest now takes a type parameter that is applied to data. It defaults to StreamRequest.

Motivation and context

To take advantage of HTTPClient.request against endpoints other than /query/v1, we need to support payloads other than QueryRequest. While we don't have an immediate use case for extending HTTPStreamRequest, I would argue it makes sense to keep the approaches the same across our two primary request types (call/response and streaming).

How was the change tested?

No tests were added for this specific change. If all existing tests pass, this is a safe change. The underlying data types are never referred to or accessed directly within the client.

Screenshots (if appropriate):

N/A

Change types

    • Bug fix (non-breaking change that fixes an issue)
    • New feature (non-breaking change that adds functionality)
    • Breaking change (backwards-incompatible fix or feature)

Checklist:

    • My code follows the code style of this project.
    • My change requires a change to Fauna documentation.
    • My change requires a change to the README, and I have updated it accordingly.

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

Copy link
Contributor

@ptpaterson ptpaterson left a comment

Choose a reason for hiding this comment

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

Nice. I agree this will help keep things straight if we extend the client to reuse the "call/response" and "streaming" paths.

@ecooper
Copy link
Contributor Author

ecooper commented Oct 9, 2024

Closed in favor of #290.

@ecooper ecooper closed this Oct 9, 2024
@ecooper ecooper deleted the FE-5921-request-data branch October 9, 2024 18: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.

2 participants