0
0
mirror of https://github.com/django/django.git synced 2024-11-22 11:57:34 +01:00
Commit Graph

46 Commits

Author SHA1 Message Date
XDEv11
221c27bd6a
Added tests for HttpResponseBase.charset/reason_phrase setters. 2023-06-10 20:43:05 +02:00
Mariusz Felisiak
254ad2e345
Fixed #34405 -- Fixed setting Content-Type header in FileResponse for compress and brotli.
Thanks Chamal De Silva for the report.
2023-03-14 05:45:30 +01:00
Bernhard M. Wiedemann
b4cdcbf239 Removed hardcoded date in SetCookieTests.test_far_expiration().
Follow up to a92c838287.
2023-02-07 20:30:00 +01:00
Carlton Gibson
bd062445cf Fixed CVE-2022-36359 -- Escaped filename in Content-Disposition header.
Thanks to Motoyasu Saburi for the report.
2022-08-03 08:46:31 +02:00
Carlton Gibson
bb61f0186d Refs #32365 -- Removed internal uses of utils.timezone.utc alias.
Remaining test case ensures that uses of the alias are mapped
canonically by the migration writer.
2022-03-24 06:29:50 +01:00
Claude Paroz
93803a1b5f Fixed #33567 -- Avoided setting default text/html content type on responses. 2022-03-09 14:50:52 +01:00
Luke Plant
f3bf6c4218 Refs #33562 -- Made HttpResponse.set_cookie() raise ValueError when both "expires" and "max_age" are passed.
This fixes the case where you might pass set_cookie(expires=val, max_age=val)
and max_age is silently ignored.
2022-03-07 08:04:18 +01:00
Luke Plant
ae2da5ba65 Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument. 2022-03-07 07:57:14 +01:00
django-bot
9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Piotr Kunicki
cb8d7ca0ba Refs #30509 -- Adjusted FileResponse test to close file earlier. 2021-10-14 15:05:27 +02:00
Piotr Kunicki
dc724c5bf9 Fixed #30509 -- Made FileResponse better handle buffers and non-zero file offsets. 2021-10-14 15:05:04 +02:00
Piotr Kunicki
3ac4764397 Refs #30509 -- Increased FileResponse test coverage.
Split tests by behavior, e.g. header, and added additional tests.
2021-10-14 15:04:30 +02:00
Nicolas Restrepo
bbb3965826 Refs #24121 -- Added __repr__() to StreamingHttpResponse and subclasses. 2021-06-22 21:28:48 +02:00
Nick Pope
d06c5b3581 Fixed #32366 -- Updated datetime module usage to recommended approach.
- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
2021-05-12 11:08:41 +02:00
Tom Carrick
bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Hasan Ramezani
d2d08c8cf6 Fixed #31982 -- Made HttpResponse.set_cookie() cast max_age argument to an integer. 2020-09-05 10:07:23 +02:00
Mariusz Felisiak
240cbb63bf
Fixed #31790 -- Fixed setting SameSite and Secure cookies flags in HttpResponse.delete_cookie().
Cookies with the "SameSite" flag set to None and without the "secure"
flag will be soon rejected by latest browser versions.

This affects sessions and messages cookies.
2020-07-16 08:16:58 +02:00
Nick Pope
8f10ceaa90 Changed '%s' % value pattern to str(value). 2020-05-04 08:27:18 +02:00
Jon Dufresne
505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02:00
Florian Apolloner
549445519c Reverted "Fixed #30565 -- Closed HttpResponse when wsgi.file_wrapper closes file-like object."
This reverts commit cce47ff65a.
2020-02-11 20:39:12 +01:00
Osaetin Daniel
b33bfc3839 Fixed #30862 -- Allowed setting SameSite cookies flags to 'none'.
Thanks Florian Apolloner and Carlton Gibson for reviews.
2019-12-12 10:52:31 +01:00
Nick Pope
7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01:00
Chris Jerdonek
cce47ff65a Fixed #30565 -- Closed HttpResponse when wsgi.file_wrapper closes file-like object. 2019-06-20 11:48:49 +02:00
ShingenPizza
de4832c49b Fixed #30196 -- Made FileResponse set Content-Disposition inline if filename is available. 2019-05-17 12:07:27 +02:00
Bernhard M. Wiedemann
5a465df70d Made a requests test that will fail in 2028 fail 10 years later.
2038 is chosen for compatibility with 32-bit systems.
2019-02-14 09:44:41 -05:00
Jon Dufresne
7785e03ba8 Fixed #30137 -- Replaced OSError aliases with the canonical OSError.
Used more specific errors (e.g. FileExistsError) as appropriate.
2019-01-28 11:15:06 -05:00
James Aylett
ee52044a27 Refs #16470 -- Fixed typo in a FileResponse test. 2018-09-01 15:14:18 +02:00
Claude Paroz
a177f854c3
Fixed #16470 -- Allowed FileResponse to auto-set some Content headers.
Thanks Simon Charette, Jon Dufresne, and Tim Graham for the reviews.
2018-05-15 18:12:11 +02:00
Alex Gaynor
9a56b4b13e Fixed #27863 -- Added support for the SameSite cookie flag.
Thanks Alex Gaynor for contributing to the patch.
2018-04-13 20:58:31 -04:00
Alvin Lindstam
47a99d7012 Fixed #28989 -- Fixed HttpResponse.delete_cookie() for cookies that use __Secure/Host prefixes. 2018-01-08 12:32:47 -05:00
Tim Graham
8e94f9f7dd Moved HttpResponse.set_cookie() tests to an appropriate location. 2018-01-08 12:01:59 -05:00
Claude Paroz
d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
roboslone
544b2ef29f Fixed #27640 -- Fixed HttpResponse's __repr__() without a 'Content-Type' header. 2016-12-27 14:42:58 -05:00
Ryan Allen
190d2ff4a7 Fixed #27153 -- Added validation for HttpResponse status. 2016-08-30 21:59:43 -04:00
Hasan
3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Johannes Hoppe
5233b70070 Fixed #25725 -- Made HttpReponse immediately close objects. 2015-12-14 12:46:48 -05:00
Jon Dufresne
05248a1009 Fixed #25576 -- Added IOBase methods required by TextIOWrapper to HttpResponse. 2015-10-21 10:42:29 -04:00
Keryn Knight
c96f11257b Refs #24121 -- Added meaningful repr() to HttpResponse and subclasses. 2015-07-15 09:01:25 -04:00
Jon Dufresne
d861f95c44 Fixed #24139 -- Changed HttpResponse.reason_phrase to evaluate based on status_code. 2015-03-12 20:18:06 -04:00
Jon Dufresne
24b2bc635e Fixed #24137 -- Switched to HTTP reason phrases from Python stdlib. 2015-01-28 06:59:40 -05:00
Sergey Parkhomenko
059c9ab24c Fixed #23977 -- Added setdefault() method to HttpResponse 2014-12-11 13:56:56 -05:00
Michael Kelly
ebc8e79cf3 Fixed #18523 -- Added stream-like API to HttpResponse.
Added getvalue() to HttpResponse to return the content of the response,
along with a few other methods to partially match io.IOBase.

Thanks Claude Paroz for the suggestion and Nick Sanford for review.
2014-11-03 12:29:19 -05:00
Unai Zalakain
5f2542f12a Fixed #10190 -- Made HttpResponse charset customizable.
Thanks to Simon Charette, Aymeric Augustin, and Tim Graham
for reviews and contributions.
2014-08-19 17:34:38 -04:00
Aymeric Augustin
6e895f9e06 Removed superfluous models.py files.
Added comments in the three empty models.py files that are still needed.

Adjusted the test runner to add applications corresponding to test
labels to INSTALLED_APPS even when they don't have a models module.
2013-12-17 11:16:48 +01:00
Jason Myers
c3791463a5 Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:48:47 -05:00
Aymeric Augustin
cb86f707a0 Fixed #12747 -- Made reason phrases customizable. 2013-05-19 13:14:54 +02:00