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

Is there a way to redirect to an external site? #55

Closed
yamaday-isid opened this issue Mar 10, 2023 · 4 comments
Closed

Is there a way to redirect to an external site? #55

yamaday-isid opened this issue Mar 10, 2023 · 4 comments

Comments

@yamaday-isid
Copy link

Thank you for developing this great project!

We are currently using django-nina-extra to develop our application.
We are facing a use case where we need to redirect responses to an external site.

The API we are developing is implemented in a class that inherits from ControllerBase and is given the api_controller decorator.

from django.shortcuts import redirect

@api_controller('sample/')
class UsersController(ControllerBase):
    @route.get('', response={302: None})
    def get_users(self):
        # not working
        return redirect("https://sample.some-page")

Is there a way to redirect to an external site?

Related issue

vitalik/django-ninja#224

@eadwinCode
Copy link
Owner

@yamaday-isid Yes, this is should fine but I will take a look at it.

@eadwinCode
Copy link
Owner

eadwinCode commented Mar 10, 2023

I have looked at this and it works fine on my end.
@yamaday-isid can you show me what error you were getting?
Also what version of the library are you on?

@yamaday-isid
Copy link
Author

@eadwinCode Thank you for checking.
And I am really sorry. It seems I was wrong.


I will share the version of the library and context we were using.

the version of the library:

  • django-ninja-extra 0.15.4

context:

We were calling our developed API endpoints from OpenAPI docs generated by django-ninja-extra (or django-ninja). - http://127.0.0.1:8000/api/docs

And I was encountering the following error.

image

We noticed that this is the correct behavior in situations where we redirect to an external site.
Django-ninaja-extra works fine.

I am really sorry.
This issue can be closed.

@eadwinCode
Copy link
Owner

Yes, In Swagger thats the behaviour when you return a redirect response. @yamaday-isid Thanks for clearing this out.

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

No branches or pull requests

2 participants