actix-web/src
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
..
client cleanup doc strings; prepare release 2018-04-16 09:30:59 -07:00
header Replace use of try!() with ? 2018-04-17 23:20:47 +01:00
middleware Let CSRF's `allowed_origin()` be specified as a type supporting `Into<String>` 2018-04-21 08:41:06 -07:00
server add custom request path quoter #182 2018-04-17 12:55:13 -07:00
ws add changelog entry 2018-04-21 07:56:11 -07:00
application.rs formatting 2018-04-18 10:49:03 -07:00
body.rs add rustfmt config 2018-04-13 16:02:01 -07:00
context.rs add rustfmt config 2018-04-13 16:02:01 -07:00
de.rs add rustfmt config 2018-04-13 16:02:01 -07:00
error.rs Use Display formatting for InternalError Display implementation #188 2018-04-19 07:55:09 -07:00
extractor.rs fix doc strings 2018-04-17 16:22:25 -07:00
fs.rs add custom request path quoter #182 2018-04-17 12:55:13 -07:00
handler.rs add rustfmt config 2018-04-13 16:02:01 -07:00
helpers.rs add rustfmt config 2018-04-13 16:02:01 -07:00
httpcodes.rs add rustfmt config 2018-04-13 16:02:01 -07:00
httpmessage.rs allow to use castom error handler for json extractor 2018-04-13 19:10:42 -07:00
httprequest.rs Add identity service middleware 2018-04-18 19:05:24 -07:00
httpresponse.rs add rustfmt config 2018-04-13 16:02:01 -07:00
info.rs add rustfmt config 2018-04-13 16:02:01 -07:00
json.rs add custom request path quoter #182 2018-04-17 12:55:13 -07:00
lib.rs remove unused dependency 2018-04-19 09:54:22 -07:00
multipart.rs add rustfmt config 2018-04-13 16:02:01 -07:00
param.rs add rustfmt config 2018-04-13 16:02:01 -07:00
payload.rs add rustfmt config 2018-04-13 16:02:01 -07:00
pipeline.rs Middleware response() is not invoked if there was an error in async handler #187 2018-04-18 14:15:53 -07:00
pred.rs add rustfmt config 2018-04-13 16:02:01 -07:00
resource.rs add rustfmt config 2018-04-13 16:02:01 -07:00
route.rs Middleware response() is not invoked if there was an error in async handler #187 2018-04-18 14:15:53 -07:00
router.rs add custom request path quoter #182 2018-04-17 12:55:13 -07:00
test.rs add rustfmt config 2018-04-13 16:02:01 -07:00
uri.rs add custom request path quoter #182 2018-04-17 12:55:13 -07:00
with.rs add rustfmt config 2018-04-13 16:02:01 -07:00