1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 16:02:59 +01:00
Commit Graph

21 Commits

Author SHA1 Message Date
Nikolay Kim
1716380f08 clippy fmt 2018-08-23 09:48:01 -07:00
Nikolay Kim
6fd686ef98 cleanup warnings 2018-07-04 21:01:27 +06:00
Nikolay Kim
fec6047ddc refactor HttpRequest mutability 2018-07-02 23:35:32 +06:00
Nikolay Kim
4fadff63f4 Use Box::leak for dynamic param names 2018-06-23 09:57:03 +06:00
Nikolay Kim
65ca563579 use read only self for Middleware 2018-06-21 23:06:23 +06:00
Josh Leeb-du Toit
9c9eb62031 Update Middleware trait to use &mut self 2018-06-02 16:47:18 +10:00
Nikolay Kim
3f5a39a5b7 cargo fmt 2018-06-01 09:37:14 -07:00
Nikolay Kim
c72d1381a6 clippy warnings 2018-04-29 09:09:08 -07:00
Nikolay Kim
de49796fd1 clippy warnings; fmt 2018-04-28 22:55:47 -07:00
Brandur
59244b203c Let CSRF's allowed_origin() be specified as a type supporting Into<String>
A very minor addition: I'm using this middleware on specific resources,
and given a non-static string, I often have to `clone()` already to get
a string into a closure. Take this code for example:

``` rust
let server = actix_web::server::new(move || {
    let csrf_origin_graphql = csrf_origin.clone();

    ...

    .resource("/graphql", move |r| {
	r.middleware(
	    csrf::CsrfFilter::new().allowed_origin(csrf_origin_graphql.as_str()),
	);

	r.method(Method::POST).a(graphql::handlers::graphql_post);
    })
```

Letting `allowed_origin()` take an `Into<String>` instead of `&str` would
prevent a second `clone()` in the code above, and also make the code a little
nicer to read (you eliminate the `.as_str()` above). This is a pattern that
seems to be common throughout actix-web already anyway, so it should also be
fine to have here.
2018-04-21 08:41:06 -07:00
Nikolay Kim
113f5ad1a8 add rustfmt config 2018-04-13 16:02:01 -07:00
Nikolay Kim
7df2d6b12a clippy warnings; extend url_for example in user guide 2018-04-09 13:30:38 -07:00
Nikolay Kim
5617896780 cleanup doc tests 2018-04-09 10:40:12 -07:00
Nikolay Kim
eb66685d1a simplify csrf middleware 2018-04-09 09:49:07 -07:00
Nikolay Kim
3ee228005d rename Application 2018-03-31 00:16:55 -07:00
Nikolay Kim
44e3df82f6 simplify http response construction; deprecate httpcodes 2018-03-30 23:07:33 -07:00
Nikolay Kim
9e751de707 re-arrange modules and exports 2018-03-30 17:31:18 -07:00
Niklas Fiekas
0278e364ec add tests for csrf upgrade filter 2018-03-07 18:42:21 +01:00
Niklas Fiekas
b9d6bbd357 filter cross-site upgrades in csrf middleware 2018-03-07 17:49:30 +01:00
Niklas Fiekas
5816ecd1bc fix variable name: cors -> csrf 2018-03-07 17:44:19 +01:00
Niklas Fiekas
10f57dac31 add csrf filter middleware 2018-03-02 20:13:43 +01:00