]> git.ipfire.org Git - thirdparty/starlette.git/log
thirdparty/starlette.git
4 years agoreset the `__eq__` and `__hash__` of HTTPConnection to allow WebSockets to be added...
Thomas Grainger [Mon, 28 Jun 2021 12:02:18 +0000 (13:02 +0100)] 
reset the `__eq__` and `__hash__` of HTTPConnection to allow WebSockets to be added to … (#1039)

4 years ago:wrench: Add funding option (#1219)
Marcelo Trylesinski [Mon, 28 Jun 2021 10:15:08 +0000 (12:15 +0200)] 
:wrench: Add funding option (#1219)

4 years agoMake Jinja2Templates.get_env private & rename (#1218)
Amin Alaee [Sun, 27 Jun 2021 12:26:14 +0000 (16:56 +0430)] 
Make Jinja2Templates.get_env private & rename (#1218)

* make-jinja2-get-env-internal

* rename _get_env to _create_env

4 years agomkdocs: Set site_url (#1215)
Jamie Hewland [Fri, 25 Jun 2021 07:46:38 +0000 (08:46 +0100)] 
mkdocs: Set site_url (#1215)

4 years agoPrepare version 0.15.0 (#1202) 0.15.0
Jamie Hewland [Wed, 23 Jun 2021 08:31:02 +0000 (09:31 +0100)] 
Prepare version 0.15.0 (#1202)

* Prepare version 0.15.0

* Remember to add a note about websocket_connect

* Add date and blurb to release notes

* Bump version to 0.15.0

* Add note about fixing #1012

4 years agoFixed TestClient error when response headers missing (#1200)
Aber [Mon, 21 Jun 2021 08:09:19 +0000 (16:09 +0800)] 
Fixed TestClient error when response headers missing (#1200)

* Fixed https://github.com/abersheeran/asgi-ratelimit/issues/14

* lint it

* Black it

Co-authored-by: euri10 <euri10@users.noreply.github.com>
4 years agoTest on Python 3.10 (#1201)
Jamie Hewland [Sat, 19 Jun 2021 17:02:53 +0000 (18:02 +0100)] 
Test on Python 3.10 (#1201)

4 years agoUse coverage directly instead of pytest-cov (#1204)
Jamie Hewland [Sat, 19 Jun 2021 11:42:56 +0000 (12:42 +0100)] 
Use coverage directly instead of pytest-cov (#1204)

* Use coverage directly instead of pytest-cov

* Use coverage's source_pkgs

4 years agoClean up last bit of aiofiles after #1157 (#1203)
Jamie Hewland [Fri, 18 Jun 2021 15:40:09 +0000 (16:40 +0100)] 
Clean up last bit of aiofiles after #1157 (#1203)

4 years agoanyio integration (#1157)
Jordan Speicher [Fri, 18 Jun 2021 14:48:43 +0000 (09:48 -0500)] 
anyio integration (#1157)

* First whack at anyio integration

* Fix formatting

* Remove debug messages

* mypy fixes

* Update README.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
* Fix install_requires typo

* move_on_after blocks if deadline is too small

* Linter fixes

* Improve WSGI structured concurrency

* Tests use anyio

* Checkin progress on testclient

* Prep for anyio 3

* Remove debug backend option

* Use anyio 3.0.0rc1

* Remove old style executor from GraphQLApp

* Fix extra import

* Don't cancel task scope early

* Wait for wsgi sender to finish before exiting

* Use memory object streams in websocket tests

* Test on asyncio, asyncio+uvloop, and trio

* Formatting fixes

* run_until_first_complete doesn't need a return

* Fix middleware app call

* Simplify middleware exceptions

* Use anyio for websocket test

* Set STARLETTE_TESTCLIENT_ASYNC_BACKEND in tests

* Pass async backend to portal

* Formatting fixes

* Bump anyio

* Cleanup portals and add TestClient.async_backend

* Use anyio.run_async_from_thread to send from worker thread

* Use websocket_connect as context manager

* Document changes in TestClient

* Formatting fix

* Fix websocket raises coverage

* Update to anyio 3.0.0rc3 and replace aiofiles

* Apply suggestions from code review

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
* Bump to require anyio 3.0.0 final

* Remove mention of aiofiles in README.md

* Pin jinja2 to releases before 3 due to DeprecationWarnings

* Add task_group as application attribute

* Remove run_until_first_complete

* Undo jinja pin

* Refactor anyio.sleep into an event

* Use one less task in test_websocket_concurrency_pattern

* Apply review suggestions

* Rename argument

* fix start_task_soon type

* fix BaseHTTPMiddleware when used without Starlette

* Testclient receive() is a non-trapping function if the response is already complete

This allows for a zero deadline when waiting for a disconnect message

* Use variable annotation for async_backend

* Update docs regarding dependency on anyio

* Use CancelScope instead of move_on_after in request.is_disconnected

* Cancel task group after returning middleware response

Add test for https://github.com/encode/starlette/issues/1022

* Add link to anyio backend options in testclient docs

* Add types-dataclasses

* Re-implement starlette.concurrency.run_until_first_complete and add a test

* Fix type on handler callable

* Apply review comments to clarify run_until_first_complete scope

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
4 years agoDeduplicate failure text in CORS preflight response (#1199)
laggardkernel [Sun, 13 Jun 2021 15:59:17 +0000 (23:59 +0800)] 
Deduplicate failure text in CORS preflight response (#1199)

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoCleanup param "workers" in WSGIMiddleware (#1146)
laggardkernel [Sun, 13 Jun 2021 15:54:34 +0000 (23:54 +0800)] 
Cleanup param "workers" in WSGIMiddleware (#1146)

Param "workers" in WSGIMiddleware.__init__ has not been used
since 0.6.3, which is changed in GH-164, commit 96c51c.

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoAdd compresslevel to GZipMiddleware (#1128)
Nikolay Bulatov [Fri, 11 Jun 2021 09:55:32 +0000 (12:55 +0300)] 
Add compresslevel to GZipMiddleware (#1128)

* Add compresslevel to GZipMiddleware
Current default level = 9
New default level = 1

Documentation gzip: https://docs.python.org/3/library/gzip.html
Benchmarks: https://tukaani.org/lzma/benchmarks.html

Reformate code

Default compress level in gzip now = 9

* Add compresslevel to GZipMiddleware

Default level = 9

Documentation gzip: https://docs.python.org/3/library/gzip.html
Benchmarks: https://tukaani.org/lzma/benchmarks.html

Reformate code

Default compress level in gzip now = 9

Co-authored-by: Tom Christie <tom@tomchristie.com>
4 years agoSmall Pythonic code changes for datastructures.py file (#1167)
Shahriyar Rzayev [Fri, 11 Jun 2021 08:46:39 +0000 (12:46 +0400)] 
Small Pythonic code changes for datastructures.py file (#1167)

* Small Pythonic code changes for datastructures.py file

* Reverting back .gitignore changes

* reverting back newline in .gitignore

* Reverting back the changes as requested during merge review

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
4 years ago🐛 Fix type hint issues due to mypy upgrade to 0.902 (#1197)
Marcelo Trylesinski [Fri, 11 Jun 2021 08:39:57 +0000 (10:39 +0200)] 
🐛 Fix type hint issues due to mypy upgrade to 0.902 (#1197)

4 years agoUpdates to python 3.6+ syntax (#1189)
Jordan Speicher [Thu, 27 May 2021 18:54:43 +0000 (13:54 -0500)] 
Updates to python 3.6+ syntax (#1189)

* Convert comment type hints to annotations

* Update to python 3.6+ syntax

* Explicitly state response type annotation

* Explicitly define queue generic type

4 years agoFix readme for ChannelBox package (#1188)
Andrey Sobolev [Wed, 26 May 2021 08:15:39 +0000 (11:15 +0300)] 
Fix readme for ChannelBox package (#1188)

Fix domain name

4 years agoUpdate README.md (#1185)
Tom Christie [Tue, 25 May 2021 10:35:18 +0000 (11:35 +0100)] 
Update README.md (#1185)

Drop defunct "community" link, since we're just using GitHub "discussions" now.

4 years agoUse non-deprecated jinja2.pass_context in Jinja 3.0+ (#1183)
Jamie Hewland [Thu, 13 May 2021 14:11:14 +0000 (15:11 +0100)] 
Use non-deprecated jinja2.pass_context in Jinja 3.0+ (#1183)

4 years agoAdd better exception msg for duplicated param names (#1177)
Yurii Karabas [Tue, 4 May 2021 09:36:16 +0000 (12:36 +0300)] 
Add better exception msg for duplicated param names (#1177)

4 years agoUpdate authentication.md (#1165)
hitrust [Wed, 28 Apr 2021 09:42:02 +0000 (17:42 +0800)] 
Update authentication.md (#1165)

import 'Starlette'

Co-authored-by: Joe <nigelchiang@outlook.com>
4 years agoRemoved the empty elif clause as it has no effect (#1168)
Shahriyar Rzayev [Wed, 28 Apr 2021 09:35:01 +0000 (13:35 +0400)] 
Removed the empty elif clause as it has no effect (#1168)

Co-authored-by: Joe <nigelchiang@outlook.com>
4 years agoRemoved redundant parantheses as returning with comma will return tuple (#1171)
Shahriyar Rzayev [Wed, 28 Apr 2021 09:28:54 +0000 (13:28 +0400)] 
Removed redundant parantheses as returning with comma will return tuple (#1171)

Co-authored-by: Joe <nigelchiang@outlook.com>
4 years agoReplaced mutable default argument with None to eliminate anti-pattern (#1173)
Shahriyar Rzayev [Wed, 28 Apr 2021 09:24:42 +0000 (13:24 +0400)] 
Replaced mutable default argument with None to eliminate anti-pattern (#1173)

Co-authored-by: Joe <nigelchiang@outlook.com>
4 years agoReplaced built-in type name with type_ as it may shadow the global scope; removed...
Shahriyar Rzayev [Wed, 28 Apr 2021 09:20:14 +0000 (13:20 +0400)] 
Replaced built-in type name with type_ as it may shadow the global scope; removed redundant variable assignment (#1174)

4 years agoprevent setup from generating an incorrect top_level.txt file in the wheel distributi...
wim glenn [Wed, 21 Apr 2021 08:29:35 +0000 (03:29 -0500)] 
prevent setup from generating an incorrect top_level.txt file in the wheel distribution (#1166)

4 years agouse quote instead of quote_plus for RedirectResponse location header (#1164)
Ben Falk [Wed, 14 Apr 2021 19:14:53 +0000 (15:14 -0400)] 
use quote instead of quote_plus for RedirectResponse location header (#1164)

* use quote instead of quote_plus for RedirectResponse location header

adjust safe characters: rem. duplicate & symbol

add test for redirect quoting

* remove unused import

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoSet explicit Origin in CORS preflight response if allow_credentials is True and allow...
Josh Wilson [Wed, 14 Apr 2021 19:10:20 +0000 (12:10 -0700)] 
Set explicit Origin in CORS preflight response if allow_credentials is True and allow_origins is wildcard (#1113)

* Set explicit Origin in CORS preflight response if allow_credentials is True and allow_origins is wildcard

When making a preflight request, the browser makes no indication as to whether the actual subsequent
request will pass up credentials. However, unless the preflight response explicitly allows the
request's `Origin` in the `Access-Control-Response-Header`, the browser will fail the CORS check and
prevent the actual follow-up CORS request. This means that responding with the `*` wildcard is not
sufficient to allow preflighted credentialed requests. The current workaround is to provide an
equivalently permissive `allow_origin_regex` pattern.

The `simple_response()` code already performs similar logic which currently only applies to
non-preflighted requests since the browser would never make a preflighted request that hits this
code due to this issue:

```
if self.allow_all_origins and has_cookie:
    headers["Access-Control-Allow-Origin"] = origin
```

This just bring the two halves inline with each other.

* Add Vary header to preflight response if allow_credentials

* Use allow_explicit_origin() for preflight request_headers

This simplifies the code slightly by using this recently added method.

It has some trade-offs, though. We now construct a `MutableHeaders` instead of a simple `dict` when
copying the pre-computed preflight headers, and we move the `Vary` header construction out of the
pre-computation and into the call handler.

I think it makes the code more maintainable and the added per-call computation is minimal.

* Convert MutableHeaders to dict for PlainTextResponse

* Revert back to dict() for preflight headers

This also names and caches some of the boolean tests in __init__() which we use in later if-blocks.
This follows the existing pattern in order to better self-document the code.

* Clean up comments

* Remove unused self.allow_credentials attribute

4 years agoAdd HEAD to CORS ALL_METHODS list (#1112)
Josh Wilson [Tue, 6 Apr 2021 20:38:48 +0000 (13:38 -0700)] 
Add HEAD to CORS ALL_METHODS list (#1112)

* Add HEAD to CORS ALL_METHODS list

The HEAD method is conspicuously absent from the allowed methods list when `allow_methods="*"` is
used. This doesn't really affect CORS preflight requests, as HEAD requests aren't preflighted by the
browser, but it does prevent the actual cross-origin HEAD response from being read by the calling
app.
[This can catch people off-guard.](https://discuss.encode.io/t/for-cors-middleware-why-is-head-not-included-in-all-methods/939)

This simply adds HEAD to the `ALL_METHODS` list in the CORS middleware module and includes some
additional tests to validate the new behavior.

* Update tests/middleware/test_cors.py to use more explicit status code check

Co-authored-by: euri10 <euri10@users.noreply.github.com>
Co-authored-by: euri10 <euri10@users.noreply.github.com>
Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoAdd Origin to Vary header on credentialed CORS response (#1111)
Josh Wilson [Tue, 6 Apr 2021 20:36:41 +0000 (13:36 -0700)] 
Add Origin to Vary header on credentialed CORS response (#1111)

* Add Origin to Vary header on credentialed CORS response

According to the [MDN CORS docs]
(https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Access-Control-Allow-Origin), the `Origin`
item should be added to the `Vary` header when the `Access-Control-Allow-Origin` is set to an
explicit origin value, as opposed to the `*` wildcard.

>If the server specifies a single origin (that may dynamically change based on the requesting origin
as part of a white-list) rather than the "*" wildcard, then the server should also include Origin in
the Vary response header — to indicate to clients that server responses will differ based on the
value of the Origin request header.

The existing code fails to update the `Vary` list when the server is configured to allow all
origins (`*`) and the request has a `Cookie` header (ie. credentialed). In that situation, the
`Access-Control-Allow-Origin` header will be set to the request's `Origin` value.

It appears this may have just been a simple oversight in the original implementation. This updates
the code to add `Origin` to the `Vary` header under these circumstancesIf it was intentionally
omitted, I'd be delighted to learn why.

* Add type annotations

* Add test to ensure that the vary header does not contain origin if request is non-credentialed

4 years agoDon't use 'raise exc from None' because it suppresses exception causes (#1158)
oTree-org [Mon, 29 Mar 2021 15:02:22 +0000 (23:02 +0800)] 
Don't use 'raise exc from None' because it suppresses exception causes (#1158)

Co-authored-by: oTree-org <chris@otree.org>
4 years agoMake session cookie use ASGI root path (#1147)
Mahmoud Hossam [Fri, 12 Mar 2021 12:49:52 +0000 (13:49 +0100)] 
Make session cookie use ASGI root path (#1147)

* Make session cookie use ASGI root path

* Check if ASGI root_path exists before using it

Co-authored-by: Tom Christie <tom@tomchristie.com>
* Remove comment

* Add test

Co-authored-by: Mahmoud Hanafy <mahmoud.hanafy@retresco.de>
Co-authored-by: Tom Christie <tom@tomchristie.com>
4 years agoFix docs syntax highlighting (#1136)
Jamie Hewland [Sun, 7 Feb 2021 19:06:30 +0000 (19:06 +0000)] 
Fix docs syntax highlighting (#1136)

* mkdocs: Use python-markdown-extensions syntax highlighter

* mkdocs: Use 2-space indent consistently in config file

4 years agoStaticFiles: Fix cache validation bug for deleted files in html mode (#1023)
ilunev [Fri, 5 Feb 2021 20:15:25 +0000 (23:15 +0300)] 
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>
4 years agoDeprecate built-in GraphQL support (#1135)
Jamie Hewland [Fri, 5 Feb 2021 19:13:39 +0000 (19:13 +0000)] 
Deprecate built-in GraphQL support (#1135)

* Deprecate GraphQLApp

* Add deprecation warning to pytest ignore list

* Tweak deprecation warnings

4 years agoVersion 0.14.2 (#1133) 0.14.2
Jamie Hewland [Tue, 2 Feb 2021 20:10:02 +0000 (20:10 +0000)] 
Version 0.14.2 (#1133)

* Prepare version 0.14.2

* Tweak changelog: Changed -> Fixed

4 years agoFix spelling (#1115)
John Bampton [Tue, 2 Feb 2021 11:13:59 +0000 (21:13 +1000)] 
Fix spelling (#1115)

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agodocs: fix simple typo, ougoging -> outgoing (#1120)
Tim Gates [Tue, 2 Feb 2021 11:09:29 +0000 (22:09 +1100)] 
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>
4 years agoRemove self from websocker example app (#1103)
Denis Eliseev [Tue, 2 Feb 2021 11:01:03 +0000 (16:01 +0500)] 
Remove self from websocker example app (#1103)

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoFix functools.partial async handlers for classmethods (#1106)
Vlad Stefan Munteanu [Tue, 2 Feb 2021 10:30:30 +0000 (12:30 +0200)] 
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>
4 years agoFix middleware traceback fetching on Python 3.8+, fix ResourceWarnings in TestClient...
Jamie Hewland [Sun, 31 Jan 2021 11:43:07 +0000 (11:43 +0000)] 
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

4 years agoAdd missing status codes (#1096)
Roman [Mon, 23 Nov 2020 16:06:26 +0000 (19:06 +0300)] 
Add missing status codes (#1096)

4 years agoAdd 208 Already Reported status code (#1095)
Roman [Fri, 20 Nov 2020 09:18:39 +0000 (12:18 +0300)] 
Add 208 Already Reported status code (#1095)

4 years agoVersion 0.14.1 (#1088) 0.14.1
Jamie Hewland [Mon, 9 Nov 2020 15:15:31 +0000 (17:15 +0200)] 
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

4 years agoRemove UJSONResponse (#1047)
Jamie Hewland [Sun, 8 Nov 2020 20:49:12 +0000 (22:49 +0200)] 
Remove UJSONResponse (#1047)

* Remove UJSONResponse

* Add documentation about custom JSON serialization

4 years agoVersion 0.14.0 (#1087) 0.14.0
Erik [Sun, 8 Nov 2020 19:50:12 +0000 (11:50 -0800)] 
Version 0.14.0 (#1087)

* Version 0.14.0 release preparation: write release-notes and version bump.

4 years agoAllow usage of functools.partial async handlers (#984)
Vlad Stefan Munteanu [Sun, 8 Nov 2020 01:33:11 +0000 (03:33 +0200)] 
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>
4 years agoUpdate responses.md (#1080)
Parzival [Wed, 28 Oct 2020 12:55:53 +0000 (18:40 +0545)] 
Update responses.md (#1080)

Small grammar correction.

4 years agoAdd 418 I'm A Teapot status code (#1076)
manuelzander [Thu, 22 Oct 2020 15:15:48 +0000 (16:15 +0100)] 
Add 418 I'm A Teapot status code (#1076)

4 years agofix 793: allow custom async iterator (#1041)
witling [Wed, 21 Oct 2020 18:10:30 +0000 (20:10 +0200)] 
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>
4 years agoFriendly spell check in `routing.md` docs. (#1073)
Jeff Astor [Thu, 15 Oct 2020 10:23:52 +0000 (06:23 -0400)] 
Friendly spell check in `routing.md` docs. (#1073)

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
4 years agoAdd type: ignore for aiofiles to make mypy happier (#1072)
Moriyoshi Koizumi [Wed, 14 Oct 2020 20:51:28 +0000 (05:51 +0900)] 
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

4 years agoTest on Python 3.9 (#1068)
Jamie Hewland [Wed, 7 Oct 2020 19:58:59 +0000 (21:58 +0200)] 
Test on Python 3.9 (#1068)

* Test on Python 3.9

* Update trove classifiers

4 years agoCreate tasks from coroutines before providing to asyncio.wait (#1066)
Jamie Hewland [Wed, 7 Oct 2020 19:20:55 +0000 (21:20 +0200)] 
Create tasks from coroutines before providing to asyncio.wait (#1066)

4 years agoFix return value of TestClient's __enter__ method (#1064)
Andrey Semakin [Fri, 2 Oct 2020 08:53:40 +0000 (13:53 +0500)] 
Fix return value of TestClient's __enter__ method (#1064)

4 years agoapply pyupgrade --py36-plus (#1048)
Thomas Grainger [Sun, 27 Sep 2020 18:47:51 +0000 (19:47 +0100)] 
apply pyupgrade --py36-plus (#1048)

4 years agoMove lifespan tests out of obsolete middleware test module (#1055)
Jamie Hewland [Fri, 11 Sep 2020 13:26:55 +0000 (15:26 +0200)] 
Move lifespan tests out of obsolete middleware test module (#1055)

* Move lifespan tests out of obsolete middleware test module

* Add test_lifespan_async

4 years agoUse format_exception instead of format_tb (#1031)
Elliana May [Fri, 11 Sep 2020 11:15:50 +0000 (19:15 +0800)] 
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>
4 years agoconfigure pytest to be stricter (#1040)
Thomas Grainger [Fri, 11 Sep 2020 09:19:47 +0000 (10:19 +0100)] 
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>
4 years agoAdd issue templates (#1054)
Jamie Hewland [Thu, 10 Sep 2020 19:30:52 +0000 (21:30 +0200)] 
Add issue templates (#1054)

4 years agoRun coverage check in CI (#1051)
Jamie Hewland [Tue, 8 Sep 2020 06:54:55 +0000 (08:54 +0200)] 
Run coverage check in CI (#1051)

* Run coverage check in CI

* Use the same step name as httpx

4 years agoallow black to pass on v20.8b1 and v19.10b0 (#1049)
Thomas Grainger [Mon, 7 Sep 2020 07:19:20 +0000 (08:19 +0100)] 
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

4 years agoUpdate CI scripts to match httpcore (#1043)
Jamie Hewland [Sun, 6 Sep 2020 10:08:07 +0000 (12:08 +0200)] 
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

4 years agoUse and pin black 20 (#1042)
Jamie Hewland [Sat, 5 Sep 2020 13:16:56 +0000 (15:16 +0200)] 
Use and pin black 20 (#1042)

5 years agoBe more lenient with route arguments in AuthencationMiddleware 'requires' decorator...
Hannes Küttner [Sun, 16 Aug 2020 14:24:23 +0000 (16:24 +0200)] 
Be more lenient with route arguments in AuthencationMiddleware 'requires' decorator (#942)

5 years agoInstall dependencies before attempting to publish. (#1030)
Erik [Sat, 15 Aug 2020 03:52:58 +0000 (20:52 -0700)] 
Install dependencies before attempting to publish. (#1030)

5 years agoVersion 0.13.8 (#1026) 0.13.8
Erik [Fri, 14 Aug 2020 03:48:43 +0000 (20:48 -0700)] 
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

5 years agoRemove maxsize arg from Queue constructor in BaseHTTPMiddleware (#1028)
Erik [Thu, 13 Aug 2020 12:48:18 +0000 (05:48 -0700)] 
Remove maxsize arg from Queue constructor in BaseHTTPMiddleware (#1028)

5 years agoUse os.PathLike in StaticFiles for directory (#1007)
Kevin Stone [Wed, 5 Aug 2020 23:04:07 +0000 (18:04 -0500)] 
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

5 years agoPrepare 0.13.7 release: version bump and release-notes (#1020) 0.13.7
Erik [Wed, 5 Aug 2020 15:07:14 +0000 (08:07 -0700)] 
Prepare 0.13.7 release: version bump and release-notes (#1020)

5 years agoFix high memory usage when using BaseHTTPMiddleware middleware classes and streaming...
Erik [Tue, 4 Aug 2020 23:55:46 +0000 (16:55 -0700)] 
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

5 years agoDOCUMENTATION -- Correction in websockets.md (#1011)
Yaakov Belch [Mon, 27 Jul 2020 10:38:02 +0000 (13:38 +0300)] 
DOCUMENTATION -- Correction in websockets.md (#1011)

Correct the exception class from `starlette.websockets.Disconnect` to `starlette.websockets.WebSocketDisconnect`

5 years agoAdd type annotation to WebSocketEndpoint.encoding (#1003)
Dan Trickey [Fri, 24 Jul 2020 10:13:14 +0000 (11:13 +0100)] 
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>
5 years agoFixed typo in websocket doc (#1009)
Justin Yo [Fri, 24 Jul 2020 10:11:10 +0000 (19:11 +0900)] 
Fixed typo in websocket doc (#1009)

Co-authored-by: YeohJerWei <yeohjerwe@gmail.com>
5 years agoVersion 0.13.6 (#1006) 0.13.6
Tom Christie [Mon, 20 Jul 2020 12:12:23 +0000 (13:12 +0100)] 
Version 0.13.6 (#1006)

* Fix staticfiles 404 errors

* Version 0.13.6

5 years agoFix staticfiles 404 errors (#1005)
Tom Christie [Mon, 20 Jul 2020 12:05:55 +0000 (13:05 +0100)] 
Fix staticfiles 404 errors (#1005)

5 years agoVersion 0.13.5 (#1001) 0.13.5
Tom Christie [Fri, 17 Jul 2020 12:41:00 +0000 (13:41 +0100)] 
Version 0.13.5 (#1001)

5 years agoMore robust path-traversal check in StaticFiles app (#985)
Tom Christie [Thu, 16 Jul 2020 14:18:29 +0000 (15:18 +0100)] 
More robust path-traversal check in StaticFiles app (#985)

* More robust path-traversal check in StaticFiles app

* Linting

5 years agofix wsgi PATH_INFO encoding (#998)
子休 [Wed, 15 Jul 2020 18:27:17 +0000 (02:27 +0800)] 
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>
5 years agoUpdate testclient.md (#1000)
Smart [Wed, 15 Jul 2020 17:29:20 +0000 (14:29 -0300)] 
Update testclient.md (#1000)

Fix bad exception name

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoUse isort v5 (#999)
Jamie Hewland [Wed, 15 Jul 2020 17:25:59 +0000 (19:25 +0200)] 
Use isort v5 (#999)

5 years agoAdd RatelimitMiddleware in docs (#988)
子休 [Mon, 29 Jun 2020 11:39:10 +0000 (19:39 +0800)] 
Add RatelimitMiddleware in docs (#988)

* add RatelimitMiddleware

* empty commit to run test

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoFix hanging graphql tests (#989)
Vlad Stefan Munteanu [Mon, 29 Jun 2020 11:35:40 +0000 (14:35 +0300)] 
Fix hanging graphql tests (#989)

* Use pytest-asyncio event loop when creating AsyncioExecutor in tests

* Reformatting line width

5 years agoUpdate third-party-packages.md (#964)
Andrey Sobolev [Wed, 10 Jun 2020 07:50:12 +0000 (10:50 +0300)] 
Update third-party-packages.md (#964)

Docs: Add link to ChannelBox in Third party packages

5 years agofix(comment typo): (#959)
Xu Jing [Mon, 8 Jun 2020 13:33:35 +0000 (09:33 -0400)] 
fix(comment typo): (#959)

Thanks!

5 years agoAllow render to access status code (#938)
W [Mon, 1 Jun 2020 10:31:04 +0000 (18:31 +0800)] 
Allow render to access status code (#938)

* Allow render to access status code

Minor change the sequence for init status and body, so render can access status code

* Move render before ini_headers

5 years agoadd missing word 'as' in the docstring for Starlette (#958)
Denzil Francis Crasta [Sat, 30 May 2020 07:08:48 +0000 (12:38 +0530)] 
add missing word 'as' in the docstring for Starlette (#958)

5 years agoFixed typos in documentation (#956)
Kevin Tewouda [Thu, 28 May 2020 13:11:22 +0000 (15:11 +0200)] 
Fixed typos in documentation (#956)

Co-authored-by: le_woudar <kevin.tewouda@gandi.net>
5 years agoRedirectResponse now accepts optional background parameter (#945)
Bartek Ciszkowski [Fri, 15 May 2020 07:42:12 +0000 (03:42 -0400)] 
RedirectResponse now accepts optional background parameter (#945)

* RedirectResponse now accepts optional background parameter

With this change, a `background` task can now be sent during a
RedirectResponse.

This can be useful when an application wishes to run a background task
after a form submission, which usually includes a redirect (e.g. to
prevent resubmission)

Closes #941

* Revert testing background in redirect test

5 years agoAllow path to contain regex meta characters (#932)
Peer Sommerlund [Mon, 11 May 2020 11:22:59 +0000 (13:22 +0200)] 
Allow path to contain regex meta characters (#932)

* Allow path to contain regex meta characters

5 years agoMiddleware should treat `body` in response ASGI messages as an optional key. (#935)
euri10 [Thu, 7 May 2020 12:50:24 +0000 (14:50 +0200)] 
Middleware should treat `body` in response ASGI messages as an optional key. (#935)

* Failing test for HEAD method when using a middleware

* Fixed by sending empty body if send_header_only

* Lint

* Respect asgi spec

* Be explicit in case we send headers only

5 years agoThread pool is no longer used for files in memory (#933)
云中君 [Wed, 6 May 2020 13:52:26 +0000 (21:52 +0800)] 
Thread pool is no longer used for files in memory (#933)

* https://github.com/Tinche/aiofiles/issues/47
Thread pool is no longer used for files in memory

* fix tests

* fix import sorted

* little change

5 years agoSupport generator function to manage startup/shutdown. (#799)
Tom Christie [Mon, 4 May 2020 10:31:54 +0000 (11:31 +0100)] 
Support generator function to manage startup/shutdown. (#799)

* Refactor lifespan to run as an async generator

* Add 'lifespan' argument

* Add 'app' argument to lifespan handler function

* Support either sync or async generators as the app 'lifespan' callable

5 years agoRequires decorator redirects with 303 status_code instead of 307 #927 (#929)
Piotr Staroszczyk [Mon, 4 May 2020 10:13:45 +0000 (12:13 +0200)] 
Requires decorator redirects with 303 status_code instead of 307 #927 (#929)

5 years agoUpdate publish (#923)
Tom Christie [Thu, 30 Apr 2020 09:26:17 +0000 (10:26 +0100)] 
Update publish (#923)

Include PYTHONPATH so that auto docs can import from the package correctly.

5 years agoVersion 0.13.4 (#922) 0.13.4
Tom Christie [Thu, 30 Apr 2020 08:48:57 +0000 (09:48 +0100)] 
Version 0.13.4 (#922)

* Add publish workflow

* Version 0.13.4

5 years agoAdd publish workflow (#921)
Tom Christie [Wed, 29 Apr 2020 14:48:44 +0000 (15:48 +0100)] 
Add publish workflow (#921)

5 years agoAdded StarletteOpentracing to the third party middleware docs (#918)
Rene Dohmen [Tue, 28 Apr 2020 12:33:48 +0000 (14:33 +0200)] 
Added StarletteOpentracing to the third party middleware docs (#918)

5 years agoDocs: Update database migration instructions (#916)
Bartek Ciszkowski [Tue, 28 Apr 2020 08:36:14 +0000 (04:36 -0400)] 
Docs: Update database migration instructions (#916)

Expand the database documentation to introduce the user to the migration
process without going too deep into Alembic. Helps complete the example
presented on the page

5 years agoCheck isort in CI (#913)
Jamie Hewland [Fri, 24 Apr 2020 09:27:34 +0000 (11:27 +0200)] 
Check isort in CI (#913)

* Check isort in CI

* Fix incorrectly sorted imports