-
Notifications
You must be signed in to change notification settings - Fork 252
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
How to set Redirect response #297
Comments
@KStenK that feature is not implemented yet. there is currently no direct access for this. we will definitely add this @sergei-maertens has volunteered to implement this feature in #283. are you still working on this? |
It's still on my todo list, but I've been swamped with more urgent things. I'll plan some time at the end of the day to get a PR going! |
@KStenK feature is now available. see here for usage: drf-spectacular/tests/test_extend_schema.py Lines 108 to 114 in d76c310
|
I don't know what I do wrong, but for me, it does not work. Here is what have I tried:
Schema generated:
|
@KStenK but now it should work. we did not account for the empty body case. |
Is there a new version with that feature out too at pip soon? |
i have to fix 2 other issues first. next release is probably next week. |
Hello,
I'm using DRF APIView and I want to show 301 redirects and redirect location in swagger-ui.
I can add a status code like this:
@extend_schema(responses={301: None})
But how can I set the response header and add the header:
Location: /
.I thought i can do something like this:
@extend_schema(responses={301: {"headers": {"Location": "/"}}
To get schema something like this:
But that does not work.
Is there any way I can do that or how should I customize responses to set headers/cookies with extend_schema?
The text was updated successfully, but these errors were encountered: