Commit Graph

758 Commits

Author SHA1 Message Date
ilunev 0ac60bbeb2
StaticFiles: Fix cache validation bug for deleted files in html mode (#1023)
* StaticFiles: Fix cache validation bug for deleted files in html mode

Previously StaticFiles would return 304 for a deleted file if its
Last-Modified date was the same as that of 404.html

* Use black formatter

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2021-02-05 20:15:25 +00:00
Jamie Hewland 32745944b0
Deprecate built-in GraphQL support (#1135)
* Deprecate GraphQLApp

* Add deprecation warning to pytest ignore list

* Tweak deprecation warnings
2021-02-05 19:13:39 +00:00
Jamie Hewland ea1990415e
Version 0.14.2 (#1133)
* Prepare version 0.14.2

* Tweak changelog: Changed -> Fixed
2021-02-02 20:10:02 +00:00
John Bampton ed73b97c9b
Fix spelling (#1115)
Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2021-02-02 11:13:59 +00:00
Tim Gates b48b80f41e
docs: fix simple typo, ougoging -> outgoing (#1120)
There is a small typo in starlette/middleware/gzip.py.

Should read `outgoing` rather than `ougoging`.

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2021-02-02 11:09:29 +00:00
Denis Eliseev 2b83c8cea6
Remove self from websocker example app (#1103)
Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2021-02-02 11:01:03 +00:00
Vlad Stefan Munteanu fe908b1c29
Fix functools.partial async handlers for classmethods (#1106)
* Showcase the bug

* Fixed functools.partial usage with classmethods

* Updated comment

* Updated docstring according to suggestion

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2021-02-02 10:30:30 +00:00
Jamie Hewland 62e95b89fc
Fix middleware traceback fetching on Python 3.8+, fix ResourceWarnings in TestClient, fix CI build (#1132)
* Add __init__ file for tests.middleware so Mypy 0.800 is happy

* testclient: Tie loop lifetime to thread

* ServerErrorMiddleware: Don't use undocumented TracebackException.exc_traceback attribute
2021-01-31 12:43:07 +01:00
Roman e4307065ea
Add missing status codes (#1096) 2020-11-23 17:06:26 +01:00
Roman 029882ee88
Add 208 Already Reported status code (#1095) 2020-11-20 10:18:39 +01:00
Jamie Hewland 71443747ae
Version 0.14.1 (#1088)
* Prepare version 0.14.1

* Add link to docs about custom JSON serialization

* Bump release date

* Add link to PR removing UJSONResponse
2020-11-09 17:15:31 +02:00
Jamie Hewland 99b37781eb
Remove UJSONResponse (#1047)
* Remove UJSONResponse

* Add documentation about custom JSON serialization
2020-11-08 22:49:12 +02:00
Erik 8bfc2a3c26
Version 0.14.0 (#1087)
* Version 0.14.0 release preparation: write release-notes and version bump.
2020-11-08 11:50:12 -08:00
Vlad Stefan Munteanu fe961dd22c
Allow usage of functools.partial async handlers (#984)
* Allow usage of async partial methods

* Added test for partial async endpoint

* Double quotes vs single quotes

* Support multiple levels of partials, check Python < 3.8

* Skip coverage for py3.8 branch

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-11-07 17:33:11 -08:00
Parzival 7a783d3b0e
Update responses.md (#1080)
Small grammar correction.
2020-10-28 14:55:53 +02:00
manuelzander 5193cdb55b
Add 418 I'm A Teapot status code (#1076) 2020-10-22 17:15:48 +02:00
witling a9f8821f3b
fix 793: allow custom async iterator (#1041)
* fix 793

* custom async generator: implement pr notes

* custom async generator: cleanup dependencies

* update tests

* newline at end of tests

* fix linting

* Update tests/test_responses.py

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* Update tests/test_responses.py

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* fix naming for custom generator tests

* comply with pep 492

* Shift streaming tests to be in one place

Co-authored-by: witling <noreply@my.email>
Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2020-10-21 20:10:30 +02:00
Jeff Astor c300bdc5b8
Friendly spell check in `routing.md` docs. (#1073)
Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2020-10-15 11:23:52 +01:00
Moriyoshi Koizumi 192ac4e988
Add type: ignore for aiofiles to make mypy happier (#1072)
* Add type: ignore to make mypy happier

* Tentatively ignore type checking failure until the following patch gets merged

https://github.com/python/typeshed/pull/4650
2020-10-14 22:51:28 +02:00
Jamie Hewland c08aefca69
Test on Python 3.9 (#1068)
* Test on Python 3.9

* Update trove classifiers
2020-10-07 21:58:59 +02:00
Jamie Hewland bfa61ad92b
Create tasks from coroutines before providing to asyncio.wait (#1066) 2020-10-07 21:20:55 +02:00
Andrey Semakin b3271a53b0
Fix return value of TestClient's __enter__ method (#1064) 2020-10-02 09:53:40 +01:00
Thomas Grainger 8dac5c2c7c
apply pyupgrade --py36-plus (#1048) 2020-09-27 19:47:51 +01:00
Jamie Hewland 41218ac546
Move lifespan tests out of obsolete middleware test module (#1055)
* Move lifespan tests out of obsolete middleware test module

* Add test_lifespan_async
2020-09-11 15:26:55 +02:00
Elliana May faea6c290a
Use format_exception instead of format_tb (#1031)
* Use format_exception instead of format_tb

This gives much more information about the exception, including causes, and the exception message itself, in addition to the trackback

* Update test

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2020-09-11 13:15:50 +02:00
Thomas Grainger b043fe56bc
configure pytest to be stricter (#1040)
* fix tests/test_datastructures::TestUploadFile PytestCollectionWarning

enhance pytest strictness to catch warnings that would have prevented
thest TestUploadFile file warning

restore cov-report and require 100% coverage

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* remove cov-fail-under

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* Update setup.cfg

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2020-09-11 11:19:47 +02:00
Jamie Hewland 7113ee8dc4
Add issue templates (#1054) 2020-09-10 21:30:52 +02:00
Jamie Hewland 46be17f7c6
Run coverage check in CI (#1051)
* Run coverage check in CI

* Use the same step name as httpx
2020-09-08 08:54:55 +02:00
Thomas Grainger aa85713d82
allow black to pass on v20.8b1 and v19.10b0 (#1049)
by running black v19.3b0 (we miss you) and then running black v20.8b1
2020-09-07 09:19:20 +02:00
Jamie Hewland b95acea973
Update CI scripts to match httpcore (#1043)
* Update CI scripts to match httpcore

* Run test suite on pushes to master

* Update scripts README

* Don't bother with flake8 extensions for now

* Remove unnecessary PYTHONPATH from build, publish

* test_routing: Use a stub app instead of ellipsis

* Add link to issue about type-checking tests
2020-09-06 12:08:07 +02:00
Jamie Hewland 8729e9fc69
Use and pin black 20 (#1042) 2020-09-05 15:16:56 +02:00
Hannes Küttner c566fc6c81
Be more lenient with route arguments in AuthencationMiddleware 'requires' decorator (#942) 2020-08-16 07:24:23 -07:00
Erik 061853550f
Install dependencies before attempting to publish. (#1030) 2020-08-14 20:52:58 -07:00
Erik 31ad4e59c3
Version 0.13.8 (#1026)
* Version 0.13.8 release

Release notes with following:
- Revert Queue maxsize fix in BaseHTTPMiddleware
- Pathlib Path's now allowed in staticfiles constructor
2020-08-13 20:48:43 -07:00
Erik f5a08d019a
Remove maxsize arg from Queue constructor in BaseHTTPMiddleware (#1028) 2020-08-13 05:48:18 -07:00
Kevin Stone 93878323e5
Use os.PathLike in StaticFiles for directory (#1007)
* Use os.PathLike in StaticFiles for directory

This allows using `pathlib.Path` in addition to `str` for configuring
the base directory of the static files in line with how python3.6+
handles filesystem operations.

Fixes #1004

* Fixed `mimetypes.guess_type` not supporting PathLike on py3.7 and below

* Updated staticfiles documentation with `PathLike` param
2020-08-05 16:04:07 -07:00
Erik 518da5eabc
Prepare 0.13.7 release: version bump and release-notes (#1020) 2020-08-05 08:07:14 -07:00
Erik 3d77a1c3e3
Fix high memory usage when using BaseHTTPMiddleware middleware classes and streaming responses (#1018)
* BaseHTTPMiddleware add maxsize arg to Queue constructor

- Limit queue size to 1 to prevent loading entire streaming response into memory
2020-08-04 16:55:46 -07:00
Yaakov Belch 1db80104f7
DOCUMENTATION -- Correction in websockets.md (#1011)
Correct the exception class from `starlette.websockets.Disconnect` to `starlette.websockets.WebSocketDisconnect`
2020-07-27 11:38:02 +01:00
Dan Trickey aee9106364
Add type annotation to WebSocketEndpoint.encoding (#1003)
* Add type annotation to WebSocketEndpoint.encoding

* Update endpoints.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-24 12:13:14 +02:00
Justin Yo 4935397611
Fixed typo in websocket doc (#1009)
Co-authored-by: YeohJerWei <yeohjerwe@gmail.com>
2020-07-24 12:11:10 +02:00
Tom Christie 60d2259a7a
Version 0.13.6 (#1006)
* Fix staticfiles 404 errors

* Version 0.13.6
2020-07-20 13:12:23 +01:00
Tom Christie 681450d658
Fix staticfiles 404 errors (#1005) 2020-07-20 13:05:55 +01:00
Tom Christie 6aa7d9e46e
Version 0.13.5 (#1001) 2020-07-17 13:41:00 +01:00
Tom Christie e611476cb7
More robust path-traversal check in StaticFiles app (#985)
* More robust path-traversal check in StaticFiles app

* Linting
2020-07-16 15:18:29 +01:00
子休 85b9c2642b
fix wsgi PATH_INFO encoding (#998)
* fix wsgi PATH_INFO encoding

* encode root_path

* wsgi middleware: Add test for PATH_INFO & SCRIPT_NAME encoding

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
2020-07-15 20:27:17 +02:00
Smart 14139c2886
Update testclient.md (#1000)
Fix bad exception name

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-15 19:29:20 +02:00
Jamie Hewland 436771aba5
Use isort v5 (#999) 2020-07-15 19:25:59 +02:00
子休 ced8c350c4
Add RatelimitMiddleware in docs (#988)
* add RatelimitMiddleware

* empty commit to run test

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-06-29 12:39:10 +01:00
Vlad Stefan Munteanu 349cc73763
Fix hanging graphql tests (#989)
* Use pytest-asyncio event loop when creating AsyncioExecutor in tests

* Reformatting line width
2020-06-29 12:35:40 +01:00