Commit Graph

140 Commits

Author SHA1 Message Date
Tom Christie c1b312ff73
Use urlsplit, not urlparse (#341) 2019-01-22 20:36:11 +00:00
Tom Christie 10b61f6cc2
Multi item form data (#339)
* Add a multidict FormData structure
2019-01-22 19:47:47 +00:00
Tom Christie 774cb40a17
Ensure query params behavior matches standard mappings. (#338)
* QueryParams behavior as standard mapping
2019-01-22 17:29:39 +00:00
Taoufik 0c3a1e4a60 f-strings everywhere (#334)
* f-strings everywhere
2019-01-22 16:24:46 +00:00
Pierre Vanliefland 24ac0b44fe Session cookie expires (#326)
* Set Max-Age on session cookies

* Format max-age as int
2019-01-18 12:59:27 +00:00
Tom Christie c220994eb1
Add `request.is_disconnected()` (#320)
* Add request.is_disconnected()

* Add request.is_disconnected
2019-01-15 09:59:59 +00:00
Tom Christie af105b23d5
Ignore database coverage if STARLETTE_TEST_DATABASE is unset (#319)
* Ignore database coverage if STARLETTE_TEST_DATABASE is unset

* Skip black on 3.7 :(
2019-01-14 12:39:40 +00:00
Tom Christie 6488650855
Apply URL escaping to form encoded key names. (#318) 2019-01-14 12:28:16 +00:00
Tom Christie 93a124805f
Drop body from responses on HEAD requests (#317)
* Drop body from responses on HEAD requests

* Linting

* Endpoints supporting HEAD should automatically support GET
2019-01-14 11:07:23 +00:00
Tom Christie a59b5295ef
Flexible requires decorator (#314)
* Remove unused imports, with 'autoflake'

* Flexible 'requires' decorator

* Linting

* Exclude coverage on uncalled line

* Merge master
2019-01-10 15:37:50 +00:00
Tom Christie 7300d873d3
Support `@requires` as a method decorator (#312)
* Support requires method decorator

* Add annotation

* Update docs for requires as a method decorator
2019-01-10 13:46:46 +00:00
Mickaël Schoentgen 2e4a4d71a8 Fix several ResourceWarning: unclosed file (#310)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 15:12:26 +00:00
Sebastián Ramírez a290bbf1a9 Fix multi field forms parsing after already having read the body (#287)
* Fix multi field forms parsing after already having read the body

* Lint / Format additional tests

* Remove unused test app section in form tests
2019-01-04 09:44:42 +00:00
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