Commit Graph

21 Commits

Author SHA1 Message Date
Sergio Benitez cc22836867 Precisely route formats. Make 'content_type' an 'Option' in 'Request'.
This commit changes the routing algorithm. In particular, it enforces
precise matching of formats. With this change, a route with a specified
format only matches requests that have the same format specified. A
route with no format specified matches any request's format. This is
contrast to the previous behavior, where a route without a specified
format would match requests regardless of their format or whether one
was specified.

This commit also changes the following:
  * The return type of the 'content_type' method of 'Request' is now
    'Option<ContentType>'.
  * The 'ContentType' request guard forwards when the request has no
    specified ContentType.
  * The 'add_header' and 'replace_header' methods take the header
    argument generically.

Closes #120.
2017-02-01 03:12:24 -08:00
Sergio Benitez 5fabb43a1b Update to serde 0.9, handlebars 0.25. Move from `map!` to `json!` macro.
Resolves #154.
2017-01-31 17:15:42 -08:00
Sergio Benitez 52d627cf44 Use only 'Request' parameter in content_types example catcher. 2017-01-31 02:46:28 -08:00
Sergio Benitez 374593c2f0 Use 'ContentType::Plain' for 'String' responses.
Resolves #49.
2017-01-31 02:43:19 -08:00
Sergio Benitez 44e367c64c Remove authorship from all examples. 2017-01-19 17:14:01 -08:00
Seth Lopez dec585dbd4 Add tests for content_types example. 2017-01-13 00:05:58 -08:00
Sergio Benitez 44296980fc Remove proc_macro as a feature - it's stabilized! 2017-01-07 20:59:35 -08:00
Sergio Benitez f5a5ea3a22 Rename `data` to `content` in `response`. Remove `DataOutcome`. 2016-10-25 13:03:50 +02:00
Sergio Benitez 6275e576b5 Updates for latest nightly. Use Tera from main branch. 2016-10-08 19:27:33 -07:00
Sergio Benitez bcb9bd860b Allow different lifetimes in handler Request reference and its contents. 2016-10-06 20:38:13 -07:00
Sergio Benitez 4b6c72e33f Use move builder pattern to launch Rocket apps. 2016-10-03 19:48:33 -07:00
Sergio Benitez 7b1dc5a1a4 Remove Rocket::new(). Use 'ignite' everywhere. 2016-10-03 19:37:49 -07:00
Sergio Benitez 920bd35d46 Update serde in examples. 2016-10-03 17:56:43 -07:00
Sergio Benitez 74ec26db95 Namespace HTTP-related type under `http`. 2016-10-03 17:09:13 -07:00
Sergio Benitez 47edc65d34 Rename data_type to data and don't export inner types. 2016-09-20 20:02:33 -07:00
Sergio Benitez 46f73ed57c Renamed macros to codegen. 2016-09-08 20:38:58 -07:00
Sergio Benitez 4d301eebbd Complete overhaul complete. 2016-09-04 04:06:28 -07:00
Sergio Benitez 8b99016af4 Add `rank` to route attribute. Macrofy is_some ContentType methods. 2016-08-27 05:10:29 -07:00
Sergio Benitez a1ad05e879 This commit is a squash of the following commits:
* Add content-type responsers for JSON, HTML, and plain text.
  * Use content-type responders in content_type example.
  * Conditionally create Request `from` HypRequest.
  * Clean-up dispatching and handling in main rocket.
  * Change Level enum to Logging Level and reexport.
  * Allow users to set logging level before launch.
  * Fix content_type example error handling.
  * Percent decode params when user requests `String`.
2016-08-26 18:37:28 -07:00
Sergio Benitez 90d8621adf Major overhual: Request, ErrorHandler, ContentType. 2016-08-26 01:55:11 -07:00
Sergio Benitez 05cf6b57c4 Add the content_types example. 2016-08-22 20:40:19 -07:00