Commit Graph

61 Commits

Author SHA1 Message Date
Sergio Benitez 6fe2f51332 Add form kitchen sink example. 2016-09-28 19:31:26 -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 cd4af6836a Add request preprocessing for _method in forms.
resolves #12
2016-09-25 02:26:15 -07:00
Sergio Benitez b911c0b73a Merge branch 'master' of github.com:SergioBenitez/rocket 2016-09-22 21:29:06 -07:00
Sergio Benitez f088459621 Require commas in template macros. 2016-09-22 21:29:03 -07:00
Sergio Benitez 31264560e4 Fix typo in hello_ranks example. 2016-09-22 21:10:36 -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 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 e8e85f09cd Add support for flash cookie. Revamp cookie support. 2016-09-11 18:57:04 -07:00
Sergio Benitez 46f73ed57c Renamed macros to codegen. 2016-09-08 20:38:58 -07:00
Sergio Benitez 32bf3e1737 Add more files to static_files example. 2016-09-08 00:02:35 -07:00
Sergio Benitez b755e53f63 Add trailing params. 2016-09-08 00:02:17 -07:00
Sergio Benitez a6967cb48f Strip lifetimes for generated param types. 2016-09-06 23:24:20 -07:00
Sergio Benitez 327b28a98e Add query params to Rocket. Use Ident for attribute params. 2016-09-04 19:18:08 -07:00
Sergio Benitez 1f19b88803 Use forked diesel to compile on latest nightly. 2016-09-04 14:24:48 -07:00
Sergio Benitez fec443a3f0 Fix issue #1. 2016-09-04 13:51:16 -07:00
Sergio Benitez 4d301eebbd Complete overhaul complete. 2016-09-04 04:06:28 -07:00
Sergio Benitez a42d7f8668 Complete rewrite of macro parsing and item generation. 2016-09-04 01:05:17 -07:00
Sergio Benitez 99074a913d Add example for future testing API. 2016-08-27 16:20:01 -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 a34374d913 Output all matching routes, not just first ranked. 2016-08-26 21:34:28 -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
Sergio Benitez 025c9243c0 Now using a Cargo workspace for (much!) faster builds. Added a temporary query
params example.
2016-08-10 17:50:08 -07:00
Sergio Benitez eabb5169de Added method specific macros. 2016-08-08 18:34:18 -07:00
Sergio Benitez 3a89cb8e2b Can now retrieve cookies from a handler. SWEET! Bumped version to 0.0.5. 2016-08-08 03:48:00 -07:00
Sergio Benitez 95a8a51b76 Added FromRequest and modified macro to use it: any parameters not declared by the user in the attributes will automatically be retrieved using FromRequest. 2016-08-08 03:10:23 -07:00
Sergio Benitez bceb1ecfb6 Added Cookied as a response: can now set cookies. Added example of setting cookies. Working on retrieving them. 2016-08-06 23:14:05 -07:00
Sergio Benitez 55d5dd2b46 Hopefully a fix for the travis bash script. 2016-08-06 20:59:51 -07:00
Sergio Benitez d16d9bd0d7 Fixed todo example. Testing script now bootstraps when needed. 2016-08-06 19:57:44 -07:00
Sergio Benitez b767c1bdec Fixed Cargo.toml in todo for new diesel. Serde is still broken. 2016-08-05 21:57:55 -07:00
Sergio Benitez c3f9e01af1 Added run notes to TODO. 2016-08-01 20:01:47 -07:00
Sergio Benitez 37cbceff67 Rust isn't subtyping lifetimes correctly, so we'll appease it. 2016-08-01 19:47:21 -07:00
Sergio Benitez 578b50b1f9 Fully working todo example. Apparently didn't commit in a while. Need to be better at that. 2016-08-01 19:07:36 -07:00
Sergio Benitez 26b7b814f4 Progress on errors. Started Todo example.
The error function now takes in a "RoutingError" structure. The idea is that the
structure includes all of the information necessary for a user to processor the
error as they wish. This interface is very incomplete and may change. At a
minimum, the error structure should include:

  1) The request that failed.
  2) Why the request failed.
  3) The chain of attempted route matches, if any.
  4) Something else?
2016-07-15 21:09:08 -07:00
Sergio Benitez 1ef7a15bab Working error handling! Not quite there yet though.
A few important things needs to get this to be 'right':
  1a. Have a way to return a response with a status code.
  1b. Use that mechanism in the default catchers.
  2. Automatically fill in that code from the #[error] handler.
  3. Have a way for a responder to say if responding succeeded.
  4. Try next highest ranking route if responding with one handler fails.
2016-04-06 13:50:02 -07:00
Sergio Benitez dc5ef6a421 Progress on error handling. Calling them 'catchers' for now.
Added `error` decorator and `errors` macro.

The current idea is that you can have "catchers" for all valid errors code (in
range [400, 500). At the moment, catchers are just request handlers, and the
decorator expected an empty function signature for the error handler. Obviously,
this is pretty useless. Not sure on what the API should be here. But, progress.

Oh, one more thing: who should handle forwarding a request to a catcher?
Probably not the router. So, the main Rocket should?
2016-04-06 03:26:43 -07:00
Sergio Benitez 0041724aa4 Slightly cleaner form exmaple. 2016-04-04 19:02:51 -07:00
Sergio Benitez d0dd49f98d Implemented FromForm derivation. Woo! 2016-04-04 04:14:18 -07:00
Sergio Benitez b7d22d58f7 Actually useful forms! 2016-04-03 22:41:31 -07:00
Sergio Benitez 3e449d2fb9 Forms are now working! 2016-04-03 21:53:25 -07:00
Sergio Benitez 293159904f Fixed codegen to work with new API. 2016-04-03 04:25:37 -07:00
Sergio Benitez 3dfa049a1a HRTB for the win! Manual routes example fully working. 2016-04-03 03:36:30 -07:00
Sergio Benitez 50bc0d6999 Major refactoring.
Here's the idea: under the `Rocket` namespace should live things critical to
writing simple Rocket apps: Request, Response, Error, etc. Nothing should be
nested more than one level deep. Only items required for more complex things
(implementing uncommon traits, etc.) should be nested one level deep.

This commit is the first attempt at realizing this.
2016-04-01 16:54:53 -07:00
Sergio Benitez 6ba67ae79a Accidentally broke optional_result example. Now fixed. 2016-03-30 14:04:00 -07:00
Sergio Benitez d477c18062 Major progress towards form support. 2016-03-30 01:02:21 -07:00