Commit graph

78 commits

Author SHA1 Message Date
David Lord
cfedcd308e strip static url trailing slash at assignment 2019-05-25 11:18:40 -07:00
Pete Beardmore
37b5569e92 fix 'static_url_path' defaulting for empty paths
-prefix a path delimiter iff there's a path to delimit
-ensures a valid default static route rule is created on application
intialisation for the case 'static_folder=""' and implicit
'static_url_path'
2019-05-25 07:03:36 -07:00
pgjones
9e0bd76d2a Allow dictionary return values as JSON
This supports an increasingly common usecase whereby JSON is the
primary response (rather than a templated string). Given Flask has a
short syntax for HTML reponses, it seems fitting that it should also
do so for JSON responses. In practice it allows,

     @app.route("/")
     def index():
         return {
             "api_stuff": "values",
         }
2019-05-24 09:48:55 -07:00
vorelq
c33ec49db6 Fix 0 port value being overriden by default
By explicitly comparing port value with None,
instead of using its bool() value.
2019-05-19 11:36:47 -07:00
Eruvanos
36362454c3 support dataclass in JSONEncoder 2019-05-18 21:37:54 -07:00
Frankie Liu
c7432f50cb Remove ending slash from static_url_path 2019-05-18 21:23:14 -07:00
David Baumgold
85ce588b3b Reformat with black
https://github.com/python/black
2019-05-06 16:28:58 -04:00
David Lord
77335fb105 clear KeyError in production for Werkzeug 0.15 2019-01-05 12:49:59 -08:00
David Lord
271d9e697a trap key errors in debug, not all 400 errors 2018-04-28 06:51:08 -07:00
David Lord
aaab1e46f2 add Response.max_cookie_size config 2018-04-10 11:17:18 -07:00
David Lord
4f8661e6e3 use subdomain arg in url_map.bind_to_environ
rename new subdomain test, parametrize
test allowing subdomains as well as ips
add subdomain_matching param to docs
add some references to docs
add version changed to create_url_adapter
2018-02-23 08:39:31 -08:00
Armin Ronacher
1e81474e7e Do not enable subdomain matching by default
Updated tests for new subdomain matching
Added a test to validate matching behavior
2018-02-23 07:53:27 -08:00
David Lord
aa4db37a7f revert copyright year to project start
add copyright header to files
2018-02-08 12:43:30 -08:00
David Lord
e431e8809d clean up samesite docs 2018-01-23 15:11:50 -08:00
Fadhel_Chaabane
c65bdc0c9f New Feature: Added Support for cookie's SameSite attribute. 2018-01-23 13:57:50 +00:00
David Lord
57b2807ea8 improve documentation for session attributes
add test for session attributes
2018-01-04 12:56:18 -08:00
David Lord
9acb1d2412 simplify logging configuration
single default handler and formatter
don't remove handlers
configure level once using setLevel
document logging
reorganize logging tests
2017-07-31 12:49:03 -07:00
William Horton
d404a911b7 Remove unused import from test_basic (#2403) 2017-06-30 17:28:48 +02:00
David Lord
d590d6024d clean up secret key docs
consistent key across docs and examples
consistent key across tests, set in conftest
2017-06-28 07:58:06 -07:00
David Lord
24cfe1b9b1 remove deprecated Flask.static_path 2017-06-26 07:45:29 -07:00
David Lord
08c8401539 failing test 2017-06-05 06:14:13 -07:00
David Lord
9c93ba2fa2 add tests for flask.json.tag 2017-06-02 10:01:30 -07:00
David Lord
7fd443c9ef Merge branch 'master' into json-object-hook 2017-06-01 06:40:27 -07:00
David Lord
35d32d265a show nice message when registering error handler for unknown code
clean up error handler docs
closes #1837
2017-05-31 18:04:08 -07:00
David Lord
c79abcb86c set description for trap as well as debug
test for key error description
2017-05-29 19:41:07 -07:00
David Lord
0873d085b1 use existing response.vary property to set vary header
closes #2345
2017-05-29 10:09:24 -07:00
Kenneth Reitz
d9c2a2fb45 Merge branch 'master' into master 2017-05-25 14:22:53 -07:00
Nina Zakharenko
c850aee84c Don't overwrite Vary header when setting for cookie access #2317 2017-05-24 20:05:11 -07:00
Christian Stade-Schuldt
55b92efab4 More DRYing up the test suite (#2325) 2017-05-24 17:27:36 -07:00
Christian Stade-Schuldt
2158fe3e12 DRYing up the test suite using pytest fixtures (#2306)
* add fixtures to conftest.py

* use fixtures in test_appctx.py

* use fixtures in test_blueprints.py

* use fixtures in test_depreciations.py

* use fixtures in test_regressions.py

* use fixtures in test_reqctx.py

* use fixtures in test_templating.py

* use fixtures in test_user_error_handler.py

* use fixtures in test_views.py

* use fixtures in test_basics.py

* use fixtures in test_helpers.py

* use fixtures in test_testing.py

* update conftest.py

* make docstrings  PEP-257 compliant

* cleanup

* switch dictonary format

* use pytest parameterization for test_json_as_unicode
2017-05-23 15:18:39 -07:00
David Lord
298bcfaeb6 set session accessed for setdefault 2017-05-20 13:00:17 -07:00
David Lord
409c8799d4 Merge branch 'master' into vary-cookies 2017-05-19 09:44:06 -07:00
David Lord
9c7e73e955 refactor session cookie domain logic
cache result of session cookie domain
add warnings for session cookie domain issues
add changelog
2017-05-13 21:59:00 -07:00
David Lord
b54d8cfc5b refactor make_response to be easier to follow
* be explicit about how tuples are unpacked
* allow bytes for status value
* allow Headers for headers value
* use TypeError instead of ValueError
* errors are more descriptive
* document that view must not return None
* update documentation about return values
* test more response types
* test error messages

closes #1676
2017-04-25 08:30:48 -07:00
David Lord
3f10dd52c6 update changelog
move test next to existing test, rename
reword / reflow param doc
2017-04-21 07:26:30 -07:00
David Lord
3d22b81edf Merge branch 'master' into jrmccarthy-master 2017-04-21 07:03:46 -07:00
David Lord
a2acabcc3f add test for build error special values 2017-04-20 08:52:37 -07:00
jab
8a2db3db18 Change Flask.__init__ to accept two new keyword arguments, host_matching and static_host. (#1560)
This enables host_matching to be set properly by the time the constructor adds
the static route, and enables the static route to be properly associated with
the required host.

Previously, you could only enable host_matching once your app was already
instantiated (e.g. app.url_map.host_matching = True), but at that point
the constructor would have already added the static route without host matching
and an associated host, leaving the static route in a broken state.

Fixes #1559.
2017-04-07 16:31:54 +02:00
Markus Unterwaditzer
6b38678139 Merge branch '0.12-maintenance' 2017-03-31 18:44:33 +02:00
Markus Unterwaditzer
247a0c906d Revert "Handle BaseExceptions (#2222)"
This reverts commit 1d4448abe3.
2017-03-31 18:44:14 +02:00
Diggory Blake
65cf64e019 Make test more idiomatic 2017-03-31 18:40:46 +02:00
Diggory Blake
965d444e0f Add test and changes 2017-03-31 18:40:46 +02:00
Diggory Blake
2774221987 Handle BaseExceptions (#2222)
* Handle BaseExceptions

* Add test and changes

* Make test more idiomatic
2017-03-31 18:07:43 +02:00
Hsiaoming Yang
9c5f048ad2 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
Josh Rowe
274edbeed6 Move object_hook outside loads method so class can be extend and reused 2017-02-23 15:25:52 +00:00
David Lord
7af6c7fa97 add test and changelog for SERVER_NAME app.run default
ref #2152
2017-01-17 14:08:33 -08:00
Andrew Arendt
9f0db54689 Added python3.6 support for tests 2017-01-10 11:20:53 -06:00
Armin Ronacher
a7fbfb387f Corrected after response for error handlers
Before this change after request functions were not correctly
invoked for error handlers.
2016-09-08 11:56:02 +03:00
Markus Unterwaditzer
ec9e9c2f6e Don't passthrough_errors unless instructed. (#2006)
Fix #2005

Revert #1679 and #1996
2016-09-06 22:32:34 +02:00
Markus Unterwaditzer
2a5061282b Only passthrough_errors if PROPAGATE_EXCEPTIONS
See pallets/werkzeug#954
2016-08-27 14:38:13 +02:00