Commit Graph

127 Commits

Author SHA1 Message Date
Florimond Manca 81d3697ba5 fix population of content-type and content-length headers (#291) 2018-12-26 17:13:51 +00:00
Sebastián Ramírez 4af75d72a9 Add tests for fixed path handling and docs (#280)
* Add tests for fixed path handling and docs

* Mark as not covered route made to never match

* Simplify docs -> routing: example for /users/me
2018-12-18 12:33:32 +00:00
Pierre Vanliefland 155c8dd625 Add on_error parameter to AuthenticationMiddleware (#281)
* Add on_error parameter to AuthenticationMiddleware to customise responses when auth fails

* Fine-tuning, type hints
2018-12-18 12:32:28 +00:00
Xavier Barbosa 5fcf4945e6 Fix mixed uploaded files and data (#277)
* Fix mixed uploaded files and data

* dropped requirement to requests_toolbelt
2018-12-18 10:26:06 +00:00
Igor Nehoroshev eb316509b5 Add security flags to session cookie (#276)
* Add security flags to session cookie

Flags: Secure, HttpOnly and SameSite=lax

* Remove Secure flag

* Add options for security flags in SessionMiddleware

* Add tests for secure session

* Lint files that Travis would like to reformat

Only related to pull request

* Return space between imports

* Add documentation for session security flags options

* Format default values
2018-12-17 16:33:41 +00:00
Tom Christie fe2b926009
Add `CommaSeparatedStrings` datatype (#274)
* Add CommaSeparatedStrings datatype

* Version 0.9.9
2018-12-14 16:22:31 +00:00
Tom Christie 96c09044e8
Add BackgroundTasks for multiple jobs. Support GraphQL background tasks. (#273) 2018-12-14 14:56:31 +00:00
Tom Christie a2613494a4
Add request.client (#272)
* Add request.client

* Docs for request.client
2018-12-14 09:58:27 +00:00
Tom Christie 4745fb1aef
Add TemplateResponse. (#269)
* Add TemplateResponse. Expose .template and .context info to test client.

* Only send 'http.response.template' if the extension is include

* Add TemplateResponse to documentation
2018-12-13 15:16:25 +00:00
Daniel Hahler d978bd4eef tests: skip test_database without DATABASE_URL (#263)
* tests: skip test_database without DATABASE_URL

(instead of causing a collection error)

* fixup! tests: skip test_database without DATABASE_URL
2018-12-11 13:09:09 +00:00
Tom Christie 1e1f3bab46
Add executemany (#259) 2018-12-10 14:37:30 +00:00
Tom Christie 256b6245f7 Version 0.9.7 2018-12-07 14:57:18 +00:00
Tom Christie ce9556acce
Authentication (#256)
* Authentication

* Fleshing out authentication support

* Version 0.9.6
2018-12-07 13:05:31 +00:00
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