202 is not a redirect, and I can’t find any standard that says where the
“next” URL can be found. So I don’t think there is a strong argument to
make the test client “follow” it or allow _handle_redirects to support it.
You’re free to subclass the test client in your own project to add support
- have you tried that?


On Sun, 20 Feb 2022 at 04:21, Clemens Wolff <clemens.wo...@gmail.com> wrote:

> Hi Django Developers,
>
> I'd like to discuss a change to the Django test client to enable
> customizing the list of status codes that are considered as redirectable
> when a GET request is made with `follow=True` (see docs in [1]).
>
> Specifically, I suggest moving the `redirect_status_codes` property in the
> `_handle_redirects` method (see code in [2]) from a local variable to a
> class-level variable so that subclasses of the test client can override the
> collection to inject additional status codes on which to redirect.
>
> This change will for example enable easy testing of APIs that use HTTP 202
> to indicate asynchronous creation of entities as described in [3].
>
> This is my first time reaching out to the mailing list. What do you think
> about this proposal? I'd be thrilled to submit a Trac ticket and pull
> request for this.
>
> Thanks for your time and looking forward to hearing from you.
> Yours,
> Clemens
>
> [1]
> https://docs.djangoproject.com/en/4.0/topics/testing/tools/#django.test.Client.get
> [2]
> https://github.com/django/django/blob/fac3dd7f390d372736e05974cc5c3ef1a3768fbb/django/test/client.py#L962-L968
> [3]
> https://docs.microsoft.com/en-us/azure/architecture/patterns/async-request-reply
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAL79TckBT5gH4xd9xOouKHD21SQULz-yLtaUPa3k%3DT7sJshUZg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAL79TckBT5gH4xd9xOouKHD21SQULz-yLtaUPa3k%3DT7sJshUZg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM36oDsUp6ZrO54KxdDqvpCfZihBZQT3tKFkqhm9oakuCQ%40mail.gmail.com.
  • Fea... Clemens Wolff
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
      • ... Clemens Wolff
        • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
          • ... Clemens Wolff

Reply via email to