Kaydet (Commit) 56d6fdbb authored tarafından bbjay's avatar bbjay Kaydeden (comit) Marc Tamlyn

Fixed #20452 -- Rename 'headers' to 'header fields'.

üst 413735b2
...@@ -578,20 +578,20 @@ streaming response if (and only if) no middleware accesses the ...@@ -578,20 +578,20 @@ streaming response if (and only if) no middleware accesses the
instantiated with an iterator. Django will consume and save the content of instantiated with an iterator. Django will consume and save the content of
the iterator on first access. the iterator on first access.
Setting headers Setting header fields
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
To set or remove a header in your response, treat it like a dictionary:: To set or remove a header field in your response, treat it like a dictionary::
>>> response = HttpResponse() >>> response = HttpResponse()
>>> response['Cache-Control'] = 'no-cache' >>> response['Cache-Control'] = 'no-cache'
>>> del response['Cache-Control'] >>> del response['Cache-Control']
Note that unlike a dictionary, ``del`` doesn't raise ``KeyError`` if the header Note that unlike a dictionary, ``del`` doesn't raise ``KeyError`` if the header
doesn't exist. field doesn't exist.
HTTP headers cannot contain newlines. An attempt to set a header containing a HTTP header fields cannot contain newlines. An attempt to set a header field
newline character (CR or LF) will raise ``BadHeaderError`` containing a newline character (CR or LF) will raise ``BadHeaderError``
Telling the browser to treat the response as a file attachment Telling the browser to treat the response as a file attachment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment