I have also found this a little odd when writing tests. It would certainly
make it easier to write both normal Django code and tests, and it's a small
addition, so +1 from me.

On Wed, 17 Jun 2020 at 15:35, Tom Carrick <t...@carrick.eu> wrote:

> I don't find myself using HttpResponse very often, usually I'm using DRF's
> Responses. But today I needed to use one, and as I was writing tests, I
> ended up somewhat astonished, so with the principle of least astonishment
> in mind... I had anticipated that I could check the headers with
> `response.headers`, similar to how the new request.headers
> <https://code.djangoproject.com/ticket/20147> works, but apparently this
> is not the case. After reading the docs, I found out that I should just
> treat the HttpResponse object itself as if it were a dictionary of headers.
> This seems very strange to me, it's not what I expect, but maybe I'm in the
> minority.
>
> I have no interest in deprecating the old API, but it would be nice if the
> headers were all accessible from a simple headers dict, and perhaps make
> this the source of truth, allowing access with any casing but preserving
> the original casing for output. It looks like what is currently
> HttpResponse._headers was once HttpRequest.headers, but this was 13 years
> ago <https://code.djangoproject.com/ticket/5479>, I don't think it'd be
> confusing to add the property back as something different.
>
> --
> 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/CAHoz%3DMa9-m%2Bfqj0wqzQ7qW5Aiw3POHtNOp2NTBaHeP_ux5FhLg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAHoz%3DMa9-m%2Bfqj0wqzQ7qW5Aiw3POHtNOp2NTBaHeP_ux5FhLg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
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/CAMyDDM2HCJKbW%3D3dNkB7BDV4R6eSAGokg%3DPENFd%3D%2BhNwaTt9OQ%40mail.gmail.com.

Reply via email to