mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
Merge branch 'master' into private-cookies
This commit is contained in:
commit
0b0bbd6bd9
@ -4,7 +4,7 @@ use diesel;
|
|||||||
use actix_web::*;
|
use actix_web::*;
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use diesel::r2d2::{ Pool, ConnectionManager };
|
use diesel::r2d2::{Pool, ConnectionManager};
|
||||||
|
|
||||||
use models;
|
use models;
|
||||||
use schema;
|
use schema;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
//! * There is no `Origin` header but the `Referer` header matches one of
|
//! * There is no `Origin` header but the `Referer` header matches one of
|
||||||
//! the allowed origins.
|
//! the allowed origins.
|
||||||
//!
|
//!
|
||||||
//! Use [`CsrfFilterBuilder::allow_xhr()`](struct.CsrfFilterBuilder.html#method.allow_xhr)
|
//! Use [`CsrfFilter::allow_xhr()`](struct.CsrfFilter.html#method.allow_xhr)
|
||||||
//! if you want to allow requests with unsafe methods via
|
//! if you want to allow requests with unsafe methods via
|
||||||
//! [CORS](../cors/struct.Cors.html).
|
//! [CORS](../cors/struct.Cors.html).
|
||||||
//!
|
//!
|
||||||
@ -32,9 +32,8 @@
|
|||||||
//! fn main() {
|
//! fn main() {
|
||||||
//! let app = App::new()
|
//! let app = App::new()
|
||||||
//! .middleware(
|
//! .middleware(
|
||||||
//! csrf::CsrfFilter::build()
|
//! csrf::CsrfFilter::new()
|
||||||
//! .allowed_origin("https://www.example.com")
|
//! .allowed_origin("https://www.example.com"))
|
||||||
//! .finish())
|
|
||||||
//! .resource("/", |r| {
|
//! .resource("/", |r| {
|
||||||
//! r.method(http::Method::GET).f(|_| HttpResponse::Ok());
|
//! r.method(http::Method::GET).f(|_| HttpResponse::Ok());
|
||||||
//! r.method(http::Method::POST).f(handle_post);
|
//! r.method(http::Method::POST).f(handle_post);
|
||||||
|
@ -61,10 +61,10 @@ impl<S: 'static> Predicate<S> for AnyPredicate<S> {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_web;
|
/// # extern crate actix_web;
|
||||||
/// use actix_web::{pred, Application, HttpResponse};
|
/// use actix_web::{pred, App, HttpResponse};
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// Application::new()
|
/// App::new()
|
||||||
/// .resource("/index.html", |r| r.route()
|
/// .resource("/index.html", |r| r.route()
|
||||||
/// .filter(pred::All(pred::Get())
|
/// .filter(pred::All(pred::Get())
|
||||||
/// .and(pred::Header("content-type", "plain/text")))
|
/// .and(pred::Header("content-type", "plain/text")))
|
||||||
|
Loading…
Reference in New Issue
Block a user