diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 2c874a1..2118d82 100644
a
|
b
|
file-like object::
|
407 | 407 | >>> response.write("<p>Here's the text of the Web page.</p>") |
408 | 408 | >>> response.write("<p>Here's another paragraph.</p>") |
409 | 409 | |
410 | | You can add and delete headers using dictionary syntax:: |
411 | | |
412 | | >>> response = HttpResponse() |
413 | | >>> response['X-DJANGO'] = "It's the best." |
414 | | >>> del response['X-PHP'] |
415 | | >>> response['X-DJANGO'] |
416 | | "It's the best." |
417 | | |
418 | | Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist. |
419 | | |
420 | 410 | Passing iterators |
421 | 411 | ~~~~~~~~~~~~~~~~~ |
422 | 412 | |
… |
… |
To set a header in your response, just treat it like a dictionary::
|
436 | 426 | >>> response = HttpResponse() |
437 | 427 | >>> response['Cache-Control'] = 'no-cache' |
438 | 428 | |
439 | | .. versionadded:: 1.1 |
440 | | |
441 | 429 | HTTP headers cannot contain newlines. An attempt to set a header containing a |
442 | 430 | newline character (CR or LF) will raise ``BadHeaderError`` |
443 | 431 | |
| 432 | Since you can treat the response object like a dictionary when it comes to |
| 433 | headers, you can also delete headers using ``del``:: |
| 434 | |
| 435 | >>> response = HttpResponse() |
| 436 | >>> response['X-DJANGO'] = "It's the best." |
| 437 | >>> del response['X-DJANGO'] |
| 438 | |
| 439 | Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist. |
| 440 | |
| 441 | .. versionadded:: 1.1 |
| 442 | |
444 | 443 | Telling the browser to treat the response as a file attachment |
445 | 444 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
446 | 445 | |