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: Add raw_response parameter support for request sending #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vblagoje
Copy link

@vblagoje vblagoje commented Feb 5, 2025

Why:

Adds support for returning raw endpoint response data thus giving developers the option to bypass model validation if needed. Mandating model validation by default without a way to disable it limits flexibility and doesn't align with best practices in software design.

What:

  • Actually implement raw_response flag in the request method.
  • Implemented multiple unit tests to verify the new raw_response functionality for JSON and text content types.

How can it be used:

To retrieve unprocessed response data from a request, set the raw_response parameter to True:

result = petstore_expanded_spec.paths["/pets/{id}"].get.request(
    base_url="http://example.com",
    parameters={"id": "1"},
    raw_response=True
)

How did you test it:

Unit tests were created to assert correct behavior of the raw_response functionality, including:

  • Verifying unparsed JSON response when raw_response is set to True.
  • Verifying unparsed text response for similar conditions.
  • Ensuring the default behavior of parsed response into models when raw_response is False.

Notes for the reviewer:

Ensure the new tests correctly distinguish between parsed and unparsed behavior of the response. Pay attention to the handling of different content types within the tests.

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.

1 participant