Commit Graph

110 Commits

Author SHA1 Message Date
Sergio Benitez d8db812856 Implement streaming requests. 2016-10-09 04:29:02 -07:00
Sergio Benitez 07204a25dd Remove Rocket::from_hyp in favor of Rocket::new. 2016-10-08 21:37:28 -07:00
Sergio Benitez a7b180c911 Remove Empty response. 2016-10-08 20:57:39 -07:00
Sergio Benitez 619b1d787e Rename Response::new to complete. Add Response::failure using newly added Failure response. 2016-10-08 20:53:04 -07:00
Sergio Benitez 0144b70fac Cleanup documentation related code. 2016-10-08 04:42:22 -07:00
Sergio Benitez e30e4e6c7f Make 'http' public. 2016-10-08 04:29:20 -07:00
Sergio Benitez c4b817ae0b Cleanup dispatch messages and comments. 2016-10-07 23:37:29 -07:00
Sergio Benitez 8c0d11feab Completely new raw API.
Summary of changes:

  * Request no longer has a lifetime parameter.
  * Handler type now includes a `Data` parameter.
  * Response is now an enum that is either `Complete` or `Forward`.
  * Outcome enum is now one of: Success, Failure, Forward.
  * Outcome::Foward for Responses must include StatusCode.
  * Responders are now final: they cannot forward to requests. (!!)
  * Responsers may only forward to catchers. (!!)
  * Response no longer provides wrapping methods.
  * Route is now cloneable.

This change is fundamental to enabling streaming requests.
2016-10-07 23:20:49 -07:00
Sergio Benitez 59623d936f Add a default template for every known error code. 2016-10-07 21:31:52 -07:00
Sergio Benitez 37e6a367b8 Move the form module under request and outcome to top-level. 2016-10-07 19:27:50 -07:00
Sergio Benitez be3530bb44 Make Outcome generic on its encapsulated type. 2016-10-07 19:09:05 -07:00
Sergio Benitez 6578de4615 Always inline appropriate Request methods. 2016-10-06 21:04:35 -07:00
Sergio Benitez 39f7f2d32b Remove unneeded lifetime in Request.
Previously, a Request's only lifetime parameter referred to itself. This
causes many issues and is simply wrong. Instead, use `transmute` to make
the lifetime `static`. As long the contents inside Request don't move or
change, the references are valid. We keep the lifetime as a phantom in
`Request` for future use.
2016-10-06 20:57:17 -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 639a78a8d6 Add a bad_request response type. Use it when form's aren't utf8. 2016-10-06 00:16:15 -07:00
Sergio Benitez 650d079b58 Make the `uri` parameter in Request private. 2016-10-06 00:08:00 -07:00
Sergio Benitez d4f9525b22 Allow error handlers to take 0, 1, or 2 parameters.
fixes #13
2016-10-04 15:05:25 -07:00
Sergio Benitez 63d31e8082 Simplify a branch in check_config macro. 2016-10-04 15:05:25 -07:00
Sergio Benitez 2ad508ed96 Test config and environments.
resolves #11
2016-10-04 15:05:25 -07:00
Sergio Benitez 463df9d1df New version: 0.0.10. 2016-10-04 15:05:16 -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 d631dfd300 Use ignite in README example. Check ROCKET_ENV without Rocket.toml being present. 2016-10-03 19:21:21 -07:00
Sergio Benitez 647efe15d1 Move uri module into http namespace. 2016-10-03 17:25:27 -07:00
Sergio Benitez 74ec26db95 Namespace HTTP-related type under `http`. 2016-10-03 17:09:13 -07:00
Sergio Benitez 17b88d0a6b Implement configuration and environments. 2016-10-03 03:39:56 -07:00
Sergio Benitez 39c979db4c Add library and usage information to main API doc. 2016-10-02 17:52:04 -07:00
Sergio Benitez 7dc6e432b8 Change wordering of ContentType structure docs. 2016-09-30 20:31:32 -07:00
Sergio Benitez 320f2e0efa Document Request. 2016-09-30 20:22:06 -07:00
Sergio Benitez 9e402dfd07 Revert visibility change in ContentType constructor. 2016-09-30 20:10:49 -07:00
Sergio Benitez 57f79ca867 Document ContentType. 2016-09-30 20:04:43 -07:00
Sergio Benitez a29d56c52e Reform top-level libs mostly according to Rustfmt. 2016-09-30 15:20:11 -07:00
Sergio Benitez 008605bec7 This commit changes parsing traits and documents some of the core library:
* All From* trait methods are now named like the trait.
  * All From* traits have an associated Error type.
  * Document all of the `form` module.
  * Add codegen tests for auto-derived forms.
  * The param parsing traits now live under Request.
2016-09-30 01:25:07 -07:00
Sergio Benitez 76cbc14d23 Cleanup core library documentation. 2016-09-29 21:44:27 -07:00
Sergio Benitez 1c4e0350d9 Use strict version numbers. Bump Rocket version. 2016-09-29 20:49:18 -07:00
Sergio Benitez a6cd1bd5bd Clean-up form parsing tests. 2016-09-28 20:39:25 -07:00
Sergio Benitez 23808d00bc This commit squash three form-related commits:
Remove form_items function in favor of FormItems iterator.

  Add specialized `bool` implementation of FromFormValue.

  Add `&str` implementation of FromFormValue for debugging.
2016-09-28 19:29:18 -07:00
Sergio Benitez b72ac78ce8 Add file test case for streaming. Fix streaming responder.
resolves #3
2016-09-25 04:07:03 -07:00
Sergio Benitez 5b5cb7e087 Send the correct content type in Template contrib. 2016-09-25 03:06:02 -07:00
Sergio Benitez b175de03ad Move extension derived content type into ContentType. 2016-09-25 02:51:18 -07:00
Sergio Benitez cd4af6836a Add request preprocessing for _method in forms.
resolves #12
2016-09-25 02:26:15 -07:00
Sergio Benitez a967018009 Add guide outline. Remove unused file. 2016-09-22 22:09:41 -07:00
Sergio Benitez f74e286e31 Add templating support in contrib crate.
The contrib crate now contains support for both Handlebars and Tera. No
documentation yet.

resolves #5
2016-09-22 04:12:07 -07:00
Sergio Benitez 53e5377482 Change meaning of Outcome::Bad. 2016-09-21 18:31:26 -07:00
Sergio Benitez 81fbc0625d Add Bad outcome. Mock config code. 2016-09-21 18:23:44 -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 a3218192dd Add contrib crate. Add JSON to contrib. Add JSON example. 2016-09-19 16:24:01 -07:00
Sergio Benitez 8824d498d1 Add streaming responder and example. 2016-09-12 02:43:34 -07:00
Sergio Benitez 4e03bb6107 Add NamedFile response type. 2016-09-12 01:51:02 -07:00
Sergio Benitez 21e26c32c0 Bump version numbers. Approaching release! 2016-09-11 18:57:47 -07:00