Commit Graph

264 Commits

Author SHA1 Message Date
赖信涛 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 c96eb9a4f7 Add Jinja2 link 2018-11-08 16:36:39 +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 291255b24c Merge branch 'master' of https://github.com/encode/starlette 2018-11-08 13:12:46 +00:00
Tom Christie c2d5813076 Link to example repo 2018-11-08 13:12:37 +00:00
Tom Christie 3faded4f26
Remove redundant test cases 2018-11-08 12:33:58 +00:00
Tom Christie bf51fc2d22 Version 0.8.0 2018-11-08 12:07:17 +00:00
Tom Christie 8f736f20ac Add SessionMiddleware's max_age to docs 2018-11-08 12:00:51 +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
Witekkq 0c3453815c fixed issue 188,trailing spaces not allowed in header (#194) 2018-11-08 09:34:06 +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 58888bb53f Version 0.7.4 2018-11-07 13:42:26 +00:00
Tom Christie b686174d0e
Add `async run_in_threadpool(func, *args, **kwargs)` (#192)
* Add run_in_threadpool

* Fix contextvars support with threadpools
2018-11-07 13:38:29 +00:00
Tom Christie 380351027b Add template snippet 2018-11-06 17:03:34 +00:00
Tom Christie 02678b3b0e Version 0.7.3 2018-11-06 16:59:54 +00:00
Tom Christie efecf56735
Add support for name to mount points. (#184)
* Support name on app.mount(...)

* Add templating docs

* Remove erronous commit

* Linting
2018-11-06 16:57:57 +00:00
Tom Christie d48bf30b75 Add docs for third party middleware classes 2018-11-06 14:06:25 +00:00
Tom Christie 385ec33700 Version 0.7.2 2018-11-06 12:21:54 +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 34d0097feb Add 'endpoint' info to scope when routing 2018-11-05 16:58:38 +00:00
Tom Christie 026b904656 Mutate scope, rather than copying it. 2018-11-05 15:21:24 +00:00
Tom Christie 90f21fbc95 Drop redundant 'router' in scope 2018-11-05 15:21:06 +00:00
Tom Christie 83ab71dad0 Version 0.7.1 2018-11-05 12:08:34 +00:00
Urchin 5ded82ff0e Update README.md (#174) 2018-11-05 11:49:00 +00:00
Marcos Schroh 537947d814 feat(DebugMiddleware): Output improved. (#179) 2018-11-05 11:46:56 +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 ed970c86be Update 'Performance' section 2018-11-01 14:41:55 +00:00
Tom Christie d86b0aa8a9 Version 0.7.0 2018-11-01 12:56:21 +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
Alexander Botello 432d55d74c Session property asserts that SessionMiddleware is installed (#161)
* return empty dict if session doesn't exist

* assert session exists
2018-11-01 11:39:44 +00:00
Tom Christie df6a5783a5
Drop lifespan.cleanup in favor of lifespan.shutdown (#165) 2018-11-01 10:42:14 +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 5488af66d7 Fix linking 2018-10-31 09:42:07 +00:00
Tom Christie 0ae9a7f523 Link out to other projects 2018-10-31 09:39:10 +00:00
Tom Christie 692ee89e10 Version 0.6.3 2018-10-30 16:11:19 +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
Kamil Endruszkiewicz 689573be2b Allow handler-like objects within routing (#163)
* Allow handler-like objects within routing

* Methods in websockets as proper endpoint
2018-10-30 15:24:07 +00:00
Johan Zietsman 78e40ba13e Fixes to static files documentation. (#162)
* I fixed a grammar error. The example code did not work, since there are no Path and PathPrefix classes in starlette.routing. I replaced PathPrefix with Mount to get it to work.

* I fixed a spelling error.
2018-10-30 13:03:40 +00:00
Tom Christie 7ab015d8e8 Update README/homepage 2018-10-29 16:49:13 +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 be6469b381 Docs on BaseHTTPMiddleware 2018-10-29 13:24:37 +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 b52fd11f32 Add release notes 2018-10-29 09:33:33 +00:00