Commit Graph

483 Commits

Author SHA1 Message Date
Sergio Benitez
92f22ca63b Fix false positives in unmounted_routes lint due to 'launch'. 2017-02-05 02:11:32 -08:00
Sergio Benitez
0b69a5d8f7 Ensure routes with and without query params don't collide. 2017-02-05 01:43:53 -08:00
Sergio Benitez
e966925455 Use full URI in codegen routes; log query params in routes. 2017-02-05 01:34:48 -08:00
Sergio Benitez
ecd72f686e Record instances in lint from launch calls. 2017-02-04 13:52:23 -08:00
Sergio Benitez
8b39b88e46 We're searching for expressiveness. 2017-02-03 19:21:19 -08:00
tborsa
4247978888 Fix typo in README: "expressibility". 2017-02-03 19:13:19 -08:00
Sergio Benitez
53390164cd Remove the unnecessary hidden field in kitchen sink example. 2017-02-03 18:56:05 -08:00
Sergio Benitez
d23a0fa80a Move lint note message to correct spot. 2017-02-03 17:38:51 -08:00
Sergio Benitez
391628dea9 Fix broken link to IntoValue. 2017-02-03 17:15:29 -08:00
Sergio Benitez
266c62fb22 Implement FromFormValue for contrib UUID. 2017-02-03 17:09:22 -08:00
Sergio Benitez
0e82eb0b31 Fixup forms documentation for new features. 2017-02-03 16:56:29 -08:00
Sergio Benitez
aefa2f1494 Use pub(crate) to enforce doc(hidden). 2017-02-03 02:17:06 -08:00
Sergio Benitez
bf1b9e76fd Tweak http module docs. 2017-02-03 01:27:41 -08:00
Sergio Benitez
a8356de183 Fully document config module. Deprecate Config::{set, default_for}. 2017-02-03 01:15:01 -08:00
Sergio Benitez
a6c27b7243 Document codegen lints. 2017-02-02 23:06:35 -08:00
Sergio Benitez
84abac7f2b Unignore template test. Upstream fix landed. 2017-02-02 18:48:34 -08:00
Sergio Benitez
5abb8d99b4 Clarify manage method docs. 2017-02-02 18:16:57 -08:00
Sergio Benitez
a88aa21b60 Commit the missing db.rs file. 2017-02-02 18:15:24 -08:00
Sergio Benitez
988236f272 Add documentation for State request guard. 2017-02-02 18:01:00 -08:00
Sergio Benitez
a15002877d Use connection pool in todo example. 2017-02-02 18:01:00 -08:00
Sergio Benitez
7f9ced7db3 Add raw sqlite example; not in workspace due to sqlite3-sys conflict. 2017-02-02 18:00:30 -08:00
Sergio Benitez
2b65be32e0 Ignore render example due to broken upstream crate. 2017-02-02 15:39:30 -08:00
Sergio Benitez
9069f91bea Remove extraneous argument from popd in todo boostrap. 2017-02-02 15:19:23 -08:00
Sergio Benitez
5dff45086a Update to tera 0.7. 2017-02-02 15:18:23 -08:00
Sergio Benitez
b69527c392 Reenable the options decorator. 2017-02-02 15:02:32 -08:00
Sergio Benitez
ecc62beeac Update uuid in contrib to 0.4. 2017-02-02 14:51:04 -08:00
Sergio Benitez
1a18c73970 Update to todo example to diesel 0.10. 2017-02-02 14:47:53 -08:00
Sergio Benitez
58678e53fb Update codegen for latest nightly. 2017-02-02 14:45:43 -08:00
Sergio Benitez
a9c3b8a919 Silence warnings during testing. 2017-02-02 02:16:21 -08:00
Sergio Benitez
7b8d104ae0 Silence cargo and diesel in todo bootstrap. 2017-02-02 01:08:43 -08:00
Sergio Benitez
d4eda278a2 Parallelize testing. Fix compiletest dependencies. 2017-02-02 00:41:47 -08:00
Sergio Benitez
4d2f695db0 Add more bad form tests to forms example. 2017-02-01 18:35:54 -08:00
Garrett Squire
11e90f525f Update status code for form processing failure. 2017-02-01 18:29:29 -08:00
Sergio Benitez
ed429cd487 Change FromForm signature. Emit 422 form errors on bad form strings.
This commit changes the way Rocket parses form items. In particular, it now
(liberally) validates form strings, returning a Bad Request on malformed inputs
and Unprocessable Entity on bad parses.

The 'FormItems' iterator was modified to accomodate this. The iterator is now
initialized using 'from': 'FormItems::from(form_string)'. The iterator can be
queried to check for a complete parse using either 'completed()' or
'exhausted()', the latter of which will consume valid keys/values and return
true only if the entire string was consumed.

The 'FromForm' trait now takes a mutable borrow to a 'FormItems' iterator.

The 'Form' and 'FormForm' implementation for 'Form' were modified to use the new
iterfaces and check for 'exhausted' after a parse, returning a Bad Request error
if the iterator cannot be exhausted.

Resolves #46.
2017-02-01 18:22:51 -08:00
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
3235e1e5e6 Make 'false' the default value for bools in forms. 2017-02-01 00:12:11 -08:00
Sergio Benitez
c0235d0cde Condense cases in 'def_id_opt'. 2017-01-31 17:38:25 -08:00
Sergio Benitez
35bbb8b60b Use 'to_string' to format Hyper headers. 2017-01-31 17:32:35 -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
724446cda4 Add categories to Cargo.toml. 2017-01-31 02:01:51 -08:00
Sergio Benitez
c1697509ba Improve lints: gather info on per-instance basis. 2017-01-31 02:01:30 -08:00
Sergio Benitez
4eaf9ba9c5 Add lints to catch unmanaged state and unmounted routes.
* The `unmanaged_state` lint emits a warning when a `State<T>` request
    guard is used without an accompanying `manage` call for `T`.

  * The `unmounted_route` lint emits a warning when a route declared via
    a Rocket attribute is not mounted via a call to `mount`.

There is one known shortcoming of these lints at present: _any_ call to
`manage` or `mount` marks state/routes as managed/mounted. This can be
an issue when an application uses more than one `Rocket` instance, with
different calls to `mount` and `manage` in each. The lints should
perform their analyses on a per-instance basis.
2017-01-29 01:13:52 -08:00
Sergio Benitez
5f04beaafc Use pegged Tera. 2017-01-28 21:52:36 -08:00
Sergio Benitez
0063f2524e Remove unused macro_use in codegen. 2017-01-27 00:06:16 -08:00
Lori Holden
f230d43fd5 Add example for the contrib UUID type. 2017-01-26 23:20:05 -08:00
Sergio Benitez
06a7317fd9 Update to Hyper 0.10. Use cookie crate directly.
A few interesting notes on this breakage:

  * `Cookie` how has a lifetime. It should be `'static'` everywhere.
  * The `SetCookie` header is no longer reexported.
  * Instead, `Cookie` implements `Into<Header>` for Set-Cookie.
2017-01-26 23:08:15 -08:00
Sergio Benitez
8fd19cce4f Use upstream Tera. Emit warning on conflicting templates. 2017-01-26 12:47:20 -08:00
Sergio Benitez
c61e740572 Allow any Serialize type in RHS of map macro. 2017-01-26 11:56:06 -08:00