Also the exception message is a little obscure: "You cannot access body
after reading from request's data stream" . What's the 'data stream' here?
--
Ticket URL: <https://code.djangoproject.com/ticket/31739>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:1>
* component: HTTP handling => Documentation
* easy: 1 => 0
* stage: Unreviewed => Accepted
Comment:
I'm not entirely convinced here...
* It's a bit generous to say `RequestDataTooBig` is documented. It's
mentioned, yes, but...
* IMO `request's data stream` is clear enough, since you're using the
stream IO API (`read()` &co.)
* Part of this stuff is undocumented because internal no?
But I guess we could add a note to the
[https://docs.djangoproject.com/en/3.0/ref/request-
response/#django.http.HttpRequest.read `HttpRequest.read()` docs] saying
something like, "if read() is used prior to accessing body, body will no
longer be available." The body docs link to `read()` saying "see more",
but then there's nothing said so some expansion might be good.
(Given that all the stream IO methods have the same issue, perhaps the
note needs to be in the `body` docs.)
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:2>
Comment (by Adam (Chainz) Johnson):
> It's a bit generous to say RequestDataTooBig is documented
Yes that's true. But at least one can search for it in the docs and find a
sentence.
> IMO request's data stream is clear enough, since you're using the stream
IO API (`read()` &co.)
It's not always clear that the streaming API has been read, as the body
can be read by some other code. The issue came up for me when trying to
access `.body` after django-rest-framework had used `.read()`.
> Part of this stuff is undocumented because internal no?
I don't think this is internal - these are exceptions that users can see
when trying to use the public interface in `.body` / `read()` etc.
I think only a few sentences are needed to describe the possible problems
so that anyone trying to debug similar issues has more information to go
on.
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:3>
* owner: nobody => Tim Park
* status: new => assigned
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/13164 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"060576b0abac460d72714e300aa709d1e7a87dd7" 060576b0]:
{{{
#!CommitTicketReference repository=""
revision="060576b0abac460d72714e300aa709d1e7a87dd7"
Fixed #31739 -- Documented dependency between HttpRequest stream IO
methods and body.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:6>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"3756a0509ae48d91070fb65921dbb2d2155c61d1" 3756a05]:
{{{
#!CommitTicketReference repository=""
revision="3756a0509ae48d91070fb65921dbb2d2155c61d1"
[3.1.x] Fixed #31739 -- Documented dependency between HttpRequest stream
IO methods and body.
Backport of 060576b0abac460d72714e300aa709d1e7a87dd7 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:7>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"502349ce77a2bbf86ec33891c37f2ee9e087d520" 502349ce]:
{{{
#!CommitTicketReference repository=""
revision="502349ce77a2bbf86ec33891c37f2ee9e087d520"
[3.0.x] Fixed #31739 -- Documented dependency between HttpRequest stream
IO methods and body.
Backport of 060576b0abac460d72714e300aa709d1e7a87dd7 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31739#comment:8>