-
-
Notifications
You must be signed in to change notification settings - Fork 227
Return the Response object when the content type is unspecified #141
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
Comments
@emannguitar this feels like something we could cover with #115 if we designed it intelligently. I haven't put too much thought into a clean API for that. I'd ideally like to give access to the full response without having to generate a different client. I thought about maybe making all endpoints return a custom |
@dbanty With #146 I was thinking of adding custom headers to the You could specify a default value for the Thoughts? |
I don't see any easy way to make this typesafe, which is an objective of the project as a whole. Unless we subclass We still have the issue of deciding what to return. Do we make a custom Response class that surfaces both our parsed data and some other data (e.g. status code, headers, raw text/bytes)? Do we expose the httpx Response and just accept the fact that we're tied to httpx and we'll break compatibility any time they do? |
I like this idea, except it also be nice to return |
In case anyone is trying to do something similar ( |
This should be covered well enough by the upcoming 0.6.0 release (currently alpha), so I'm marking this one done. |
Is your feature request related to a problem? Please describe.
Sometimes the content type is unspecified in the OpenAPI doc (For instance, FastAPI's
RedirectResponse
doesn't convert to a proper response type), leading to functions accessing these endpoints to simply returnNone
upon success.Describe the solution you'd like
When an endpoint's content type is unspecified, the generated function should just return the
Response
object. Returning theResponse
in any case where a successful operation would return None might be a good idea as well as a catch-all. This is different from #115, as this only applies to certain endpoints and would just return the rawResponse
object as there is nothing else (schemas etc) to access.Additional context
In my specific case, I have an endpoint that redirects to a download, and I am unable to use the generated function for said endpoint to download the file.
The text was updated successfully, but these errors were encountered: