MikeTheReader
6f49089a62
Added tests for make_response and get_debug_flag to improve coverage of helpers.py
2017-05-22 16:15:48 -07:00
David Lord
2a65794306
safe_join on Windows uses posixpath
...
fixes #2033
closes #2059
2017-05-15 16:58:01 -07:00
David Lord
46f83665ef
clean up blueprint json support
...
add changelog for #1898
2017-04-24 10:16:50 -07:00
David Lord
74b3f7e04c
Merge pull request #1898 from RaHus/per_blueprint_jsoncoding_#1710
...
Per blueprint jsoncoding #1710
2017-04-24 10:16:20 -07:00
David Lord
bf6910a639
get mtime in utc
2017-04-13 14:55:56 -07:00
David Lord
f790ab7177
need to test against raw header
...
parsing prefers the last value parsed for the option
2017-04-08 10:33:06 -07:00
David Lord
c1973016ea
style cleanup
...
break out header parts in test
test for no filename* parameter for ascii header
2017-04-07 18:02:31 -07:00
Antonio Larrosa
6ef45f30ab
Fix previous commits to work with python 2 and python 3
...
Also, parse_options_header seems to interpret filename* so we better
test the actual value used in the headers (and since it's valid
in any order, use a set to compare)
2017-03-24 20:05:01 +01:00
Antonio Larrosa
0049922f2e
Fix send_file to work with non-ascii filenames
...
This commit implements https://tools.ietf.org/html/rfc2231#section-4 in
order to support sending unicode characters. Tested on both Firefox and
Chromium under Linux.
This adds unidecode as a dependency, which might be relaxed by using
.encode('latin-1', 'ignore') but wouldn't be as useful.
Also, added a test for the correct headers to be added.
Previously, using a filename parameter to send_file with unicode characters, it
failed with the next error since HTTP headers don't allow non latin-1 characters.
Error on request:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 186, in execute
write(b'')
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 152, in write
self.send_header(key, value)
File "/usr/lib64/python3.6/http/server.py", line 509, in send_header
("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\uff0f' in position 58: ordinal not in range(256)
Fixes #1286
2017-03-23 17:30:48 +01:00
Hsiaoming Yang
a7f1a21c12
Don't rely on X-Requested-With for pretty print json response ( #2193 )
...
* Don't rely on X-Requested-With for pretty print json response
* Fix test cases for pretty print json patch
* Fix gramma error in docs for pretty print json config
* Add changelog for JSONIFY_PRETTYPRINT_REGULAR
2017-03-07 10:09:46 +09:00
Jiri Kuncar
36425d5f91
Ignore cache on request.get_json(cache=False) call ( #2089 )
...
* Test cache argument of Request.get_json
* Ignore cache on request.get_json(cache=False) call
Removes usage of `_cached_json` property when `get_json` is called with
disabled cache argument. (closes #2087 )
2016-12-21 21:08:38 +01:00
Alex Kahan
2647fc7112
Parameterizing test ( #2073 )
2016-11-03 10:11:24 -07:00
Joël Charles
7186a5aaf5
make use of range requests if available in werkzeug ( #2031 )
...
* make use of range requests if available in werkzeug
* different logic for testing werkzeug functionality
2016-09-26 12:43:46 +02:00
Armin Ronacher
a30951ec28
Do not error for unknown files if send_file sends an actual file
2016-09-10 03:33:53 +03:00
Roman
92ce20eeac
Fix error in send_file helper ( #2003 )
...
* Fix error in send_file (mimetype_filename is not defined)
* fix formatting error message in send_file
2016-09-04 16:28:05 -07:00
Markus Unterwaditzer
71e10be286
Properly remove f.name usage in send_file ( #1988 )
...
* Properly remove f.name usage in send_file
* Update changelogs
* Fix tests
2016-08-26 03:08:03 +02:00
David Lord
f193f590bc
clean up new json tests
2016-08-21 08:47:12 -07:00
Nathan Land
f16e477b2a
Add tests for flask.json.dump() and test that jsonify correctly converts uuids.
2016-08-21 07:48:05 -07:00
RamiC
4305ebdf66
Check for a request ctx before using the request.
...
Use the app json coder when blueprint json coder is set to none.
Revert the failling test to using an app_context
re #1710
2016-06-08 12:58:56 +03:00
RamiC
501b8590dd
Allow per blueprint json encoder decoder
...
re #1710
2016-06-08 12:03:26 +03:00
David Lord
7c271401b2
pass value directly to last_modified
2016-06-05 12:42:34 -07:00
Prachi Shirish Khadke
af515cc7ea
Add last_modified arg for send_file
...
Enhancement: Add last_modified arg of type DateTime to send_file.
Fixes pallets/flask#1321
2016-06-05 10:59:17 -07:00
Giampaolo Eusebi
06a170ea9b
Add tests for safe_join
2016-06-04 11:26:44 +02:00
Dan Sully
8458cc5cd1
Remove deprecation warnings for add_etags & mimetype guessing for send_file()
...
Fix #1849
2016-06-03 14:52:33 +02:00
Markus Unterwaditzer
6c359e0f53
Eliminate some resource warnings
2016-06-03 14:29:27 +02:00
Markus Unterwaditzer
293eb583f6
More explicit warning categories
2016-06-03 14:04:25 +02:00
Markus Unterwaditzer
d393597c50
Use recwarn everywhere
...
...instead of custom fixture. Also assert that no warnings are left over
after the test.
2016-06-03 13:59:47 +02:00
David Lord
024fbe5a60
Revert "Adds simplejson as a testing target." ( #1865 )
2016-06-02 14:54:49 -07:00
James Farrington
390cd5e4ee
Fixed #1846
2016-06-02 11:58:02 -07:00
Armin Ronacher
6aee9f6d77
Resolve state issue for url_for with forced scheme
...
This fixes #1596
2016-05-22 10:45:29 +02:00
David Hou
9f1be8e795
Raise BadRequest if static file name is invalid
...
* Raise BadRequest if static file name is invalid
* Clean up syntax a bit
* Remove unnecessary close()
2016-04-02 21:07:27 +02:00
Shipeng Feng
cc536c8a7b
Fixed stream_with_context if decorated function has parameters
2016-04-01 16:17:45 -07:00
Jeff Widman
daceb3e3a0
Add support for serializing top-level arrays to JSON
...
Fix #170 , #248 , #510 , #673 , #1177
2016-01-13 13:20:11 -08:00
Keyan Pishdadian
1cd9e91810
Changed error message to include actual exception contents
2015-03-05 13:04:38 -05:00
Keyan Pishdadian
d6a1307f9d
Change strings to bytes to support Python3, typo in function name
2015-03-04 15:14:43 -05:00
Keyan Pishdadian
294961e6fc
Change tests to support older response format
2015-03-04 14:48:08 -05:00
Keyan Pishdadian
39e66ca6d7
Add tests for adding exception to response contents only when DEBUG is True
2015-03-04 14:40:16 -05:00
Ben Jones
61263e08f9
Add datetime.date support to JSONEncoder
2015-01-23 07:44:17 -06:00
Parkayun
33534bb4a9
Happy New Year 2015
2015-01-02 11:35:00 +09:00
Markus Unterwaditzer
192da325f8
Testsuite is not a package
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
77d887526d
Rename fixture apps_tmpdir
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
a00ccdce94
Remove more test_apps
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
af4cb0ff2b
Remove flask superclass
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
af41dbe0c4
Remove useless classes
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
5da2c00419
Rewrite assertion methods
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
8fa5e32d9a
Tests pass now.
2014-09-11 22:09:50 +02:00
Markus Unterwaditzer
961db8ad72
Made tests recognizable
2014-09-11 22:09:50 +02:00