Commit Graph

114 Commits

Author SHA1 Message Date
Tom Christie 08af34763d
Version 0.9.4 (#251) 2018-12-05 16:38:45 +00:00
Tom Christie 5712d95017 Add Secret 2018-12-05 12:38:54 +00:00
Tom Christie d2512656e3 Add Environ, DatabaseURL 2018-12-05 12:28:18 +00:00
Tom Christie 1a20c63f14
Add Config() (#250)
* Add Config()

* Fix STARLETTE_TEST_DATABASE in tests
2018-12-05 11:53:38 +00:00
Tom Christie 26d46d5a6e
Hide password in URL.__repr__ (#247) 2018-12-04 16:05:33 +00:00
Tom Christie 0b7819b4b2
Add DatabaseMiddleware (#243)
* Add `DatabaseMiddleware`
2018-12-04 16:05:16 +00:00
Pierre Vanliefland 78f57f95ee Add context with request when executing GraphQL query (#244)
Add context with request when executing GraphQL query
2018-12-04 12:55:10 +00:00
Tom Christie 16e8b87f72
Version 0.9.1 (#239) 2018-11-28 13:36:22 +00:00
Tom Christie 632150d73e
Lifespan as middleware (#225)
* Lifespan as middleware
* 3.6 compat
* Add annotations
* Handle exceptions from applications within LifespanMiddleware
* Lifespan moves to middleware. TestClient can be used as a context manager.
2018-11-28 11:51:17 +00:00
Tom Christie ed16b7df21
Asyncio cleanups (#236) 2018-11-23 11:11:16 +00:00
Shen Li 80369c1b85 add tests for chunked requests (#235) 2018-11-23 08:56:37 +00:00
Alexander Botello 95517b7002 remove unused imports (#228) 2018-11-21 19:12:44 +00:00
Tom Christie 98fa5598de Tweak test case 2018-11-16 13:52:05 +00:00
supriyo-biswas 1e4ce58ec7 Fix incorrect decoding of application/x-www-form-urlencoded request body (#217)
* Fix incorrect decoding of application/x-www-form-urlencoded request body.

* Add test for URLencoded forms.
2018-11-16 13:51:14 +00:00
Tom Christie 14650bfd22
URL convertors (#221)
* Version 0.8.4

* Add support for path convertors

* Add to_string on convertors
2018-11-16 13:50:55 +00:00
赖信涛 a0bb1f5f23 Suooprt HTTP 304 for static files. (#212)
* feat: support HTTP 304

* test for staticfiles 304

* fix email.utils functions

* fix mypy test, just ignore parsedate result type

* not reparsing the FileResponse

* fix black check

* delete unused import and print

* fix type annotation
2018-11-14 11:38:01 +00:00
Tom Christie c504323eaf
Default to empty body on responses (#208) 2018-11-09 17:59:58 +00:00
Tom Christie 7455fd1f47
URL reconstruction fix (#204)
* Version 0.8.2

* Fix URL reconstruction
2018-11-09 13:39:51 +00:00
赖信涛 8e30f073f0 Do not read file for HEAD method on StaticFiles (#176)
* Do not read file for HEAD method on StaticFiles

* bugfix left in FileResponse

* add test for StaticFiles HEAD method

* restore aiofiles'open after testcase

* format code using black

* Send "http.response.body" instead of disconnect.

body default to b"";
more_body default to False;

fix testcase.

* rebase master, revert background task back

* update param name, send_header_only -> method

* No need to instantiate a new Request, just use scope

* style code using black
2018-11-08 16:59:00 +00:00
Tom Christie 2ef21f49c9
Jinja2 (#198)
* Use jinja2 for a default template configuration

* Add release notes
2018-11-08 16:14:14 +00:00
Tom Christie 3faded4f26
Remove redundant test cases 2018-11-08 12:33:58 +00:00
Jesse Braham a7e0af0a98 Implement session expiry with configurable maximum age (#186)
* Set a maximum age for sessions

* Test session expiry for full coverage

* Fix mypy error

* Handle old-style sessions (ie. no timestamp)
2018-11-08 11:59:27 +00:00
Tom Christie 9f3dcb7d2b
Rejig ExceptionMiddleware and ServerErrorMiddleware (#193)
* Rejig ExceptionMiddleware and ServerErrorMiddleware

* Tweak DebugMiddleware implementation

* Support custom 500 handlers

* Exception handling updates
2018-11-08 11:59:15 +00:00
Alexander Botello 150c7092e5 StaticFiles will check if directory exists upon instantiation (#195)
* Add check_dir parameter

* Add test coverage for check_dir

* Update documentation

* linting

* Remove extra space
2018-11-08 09:33:20 +00:00
Tom Christie 3e2e3430d1
Add `@app.middleware(...)` decorator (#183)
* Add @app.middleware() decorator

* Linting

* Drop erronous check-in

* Type hinting for BaseHTTPMiddleware
2018-11-06 12:19:52 +00:00
Tom Christie 3c7573715d
Add www_redirect behavior to TrustedHostsMiddleware (#181) 2018-11-05 11:38:20 +00:00
zya-performance 552e0f6f2d adds background task param to StreamingResponse and FileResponse (#167)
*  adds background task param to StreamingResponse

* allows FileResponse to run a background task after last bye is sent

* test StreamingResponse and FileResponse with background task

* linted

* added a blank line to match CI expectations
2018-11-05 11:38:05 +00:00
Tom Christie 23c009ca53
Finesse mount routing (#173)
* Finesse mount routing

* Add redirect_slashes behavior

* Add redirect_slashes behavior

* Support url_path_for, with mounted apps.
2018-11-05 11:11:35 +00:00
Tom Christie 5584568f8a
Drop add_graphql_route, in favor of more consistent API style (#170) 2018-11-01 12:52:16 +00:00
Tom Christie 81c4306a3a
Add OpenAPIResponse, API Schema docs, etc... (#171) 2018-11-01 12:52:03 +00:00
Tom Christie de010e7796
Return strings from `url_path_for` (#169)
Schema generation & return strings from `url_path_for`
2018-11-01 10:40:08 +00:00
Tom Christie 96c51c959a
Routing tweaks (#164)
* Ensure url_path_for works with Mount('/{some_path_params}')

* Fix Router(default=) argument

* Support partial matches on routing, to support handlers with same path, but different methods.

* Run sync views in threadpool

* Use default executor for WSGI middleware
2018-10-30 16:08:05 +00:00
Tom Christie 244916e1de
Support clearing sessions (#158)
* Use isort for consistent import ordering

* Add SessionMmiddleware support

* Add SessionMiddleware support

* Support clearing sessions

* Version 0.6.2
2018-10-29 16:43:40 +00:00
Tom Christie 87da226f1c
Session middleware (#157)
* Use isort for consistent import ordering

* Add SessionMmiddleware support

* Add SessionMiddleware support
2018-10-29 16:16:51 +00:00
Tom Christie bcf876c686
Use isort for consistent import ordering (#156) 2018-10-29 14:46:42 +00:00
Tom Christie ee4732f385
BaseHTTPMiddleware (#155)
* Support app.url_path_for and request.url_for

* Minor tweak to release notes

* Added BaseHTTPMiddleware
2018-10-29 13:02:43 +00:00
Tom Christie c047fe4e75
Support app.url_path_for and request.url_for (#153) 2018-10-29 11:14:42 +00:00
Tom Christie 8da0f00fe7
Routing interface (#144)
* Path -> Route, PathPrefix -> Mount

* Route, WebSocketRoute, Mount

* Use Route(endpoint=...), not Route(app=...)

* Bare minimum docs update

* Add url_for

* request.path_params and session.path_params

* Version 0.6.0
2018-10-29 09:22:45 +00:00
Tom Christie f53b172f8a
Domain wildcards for trusted host (#151)
* Support domain wildcards with TrustedHostMiddleware

* Support domain wildcards with TrustedHostMiddleware

* Include domain wildcards in TrustedHostMiddleware docs
2018-10-29 09:22:13 +00:00
Alexander Botello cdb08bc644 Drop support for `StaticFile` (#145)
* Add runtime checks inside FileResponse w/ tests

* Drop support of StaticFile

* update documentation
2018-10-28 18:04:17 +00:00
Ryan Kaskel a32ea0a8e8 Return an iterator over keys for Headers and QueryParams (#142) 2018-10-26 13:29:25 +01:00
Alexander Botello 3ca34ce0a2 Support a routing interface for `Router` (#143)
* Add a routing interface to Router

* Starlette class now wraps routing functionality from Router

* No need to pass in empty list

* Add missing test coverage

* black that one file i always forget
2018-10-26 10:30:54 +01:00
Alexander Botello bc26ab3319 Support either `cleanup` or `shutdown` in ASGI lifespan messages (#134)
* support either cleanup or shutdown in ASGI message

* change event_type in tests

* update docs

* fix typo

* keep  as event_type for now

* exclude line 65

* blackify

* replace cleanup with shutdown in docs
2018-10-22 15:08:04 +01:00
Tom Christie 137c2ab70e Add 'app.add_graphql_route()' 2018-10-18 16:58:49 +01:00
Tom Christie c0f9f60ae9 Add graphiql support 2018-10-18 15:24:26 +01:00
Tom Christie 315a21be85
GraphQL support (#126)
* GraphQL support

* GraphQL support

* Run GraphQL queries inside a threadpool

* Support AsyncioExecutor

* GraphQL error formatting

* Docs for GraphQL support
2018-10-18 14:45:18 +01:00
Tom Christie 67b8d71601
Revisit WebSocket status codes (#119) 2018-10-18 08:47:04 +01:00
Alexander Botello b0763469ff Support a function-based interface for adding events on LifespanHandler (#124)
* Add function interface to lifespanhandler

* function interface accessible added to applications

* Add test for add_event_handler
2018-10-18 08:43:21 +01:00
Tom Christie 860fdf6c8b
Add WSGI middleware (#120)
* Add WSGI middleware

* Fix for WSGI middleware tests
2018-10-17 16:54:02 +01:00
Tom Christie 2b2c07078c Fix Headers repr 2018-10-17 14:01:26 +01:00