mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
Merge pull request #132 from andreevlex/spell-check-24-03
spelling check
This commit is contained in:
commit
5127b85672
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2017 Nikilay Kim
|
Copyright (c) 2017 Nikolay Kim
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any
|
Permission is hereby granted, free of charge, to any
|
||||||
person obtaining a copy of this software and associated
|
person obtaining a copy of this software and associated
|
||||||
|
@ -15,7 +15,7 @@ fn index(_req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
|||||||
.map_err(error::Error::from) // <- convert SendRequestError to an Error
|
.map_err(error::Error::from) // <- convert SendRequestError to an Error
|
||||||
.and_then(
|
.and_then(
|
||||||
|resp| resp.body() // <- this is MessageBody type, resolves to complete body
|
|resp| resp.body() // <- this is MessageBody type, resolves to complete body
|
||||||
.from_err() // <- convet PayloadError to a Error
|
.from_err() // <- convert PayloadError to a Error
|
||||||
.and_then(|body| { // <- we got complete body, now send as server response
|
.and_then(|body| { // <- we got complete body, now send as server response
|
||||||
httpcodes::HttpOk.build()
|
httpcodes::HttpOk.build()
|
||||||
.body(body)
|
.body(body)
|
||||||
@ -36,7 +36,7 @@ fn streaming(_req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
|||||||
// read one chunk from client response and send this chunk to a server response
|
// read one chunk from client response and send this chunk to a server response
|
||||||
// .from_err() converts PayloadError to a Error
|
// .from_err() converts PayloadError to a Error
|
||||||
.body(Body::Streaming(Box::new(resp.from_err())))
|
.body(Body::Streaming(Box::new(resp.from_err())))
|
||||||
.map_err(|e| e.into()) // HttpOk::build() mayb return HttpError, we need to convert it to a Error
|
.map_err(|e| e.into()) // HttpOk::build() maybe return HttpError, we need to convert it to a Error
|
||||||
})
|
})
|
||||||
.responder()
|
.responder()
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ struct AppState {
|
|||||||
counter: Cell<usize>,
|
counter: Cell<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// somple handle
|
/// simple handle
|
||||||
fn index(req: HttpRequest<AppState>) -> HttpResponse {
|
fn index(req: HttpRequest<AppState>) -> HttpResponse {
|
||||||
println!("{:?}", req);
|
println!("{:?}", req);
|
||||||
req.state().counter.set(req.state().counter.get() + 1);
|
req.state().counter.set(req.state().counter.get() + 1);
|
||||||
|
@ -51,7 +51,7 @@ impl Handler<CreateUser> for DbExecutor {
|
|||||||
name: &msg.name,
|
name: &msg.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
// normal diesl operations
|
// normal diesel operations
|
||||||
diesel::insert_into(users)
|
diesel::insert_into(users)
|
||||||
.values(&new_user)
|
.values(&new_user)
|
||||||
.execute(&self.0)
|
.execute(&self.0)
|
||||||
|
@ -103,8 +103,8 @@ pub enum ProtocolError {
|
|||||||
/// A payload reached size limit.
|
/// A payload reached size limit.
|
||||||
#[fail(display="A payload reached size limit.")]
|
#[fail(display="A payload reached size limit.")]
|
||||||
Overflow,
|
Overflow,
|
||||||
/// Continuation is not supproted
|
/// Continuation is not supported
|
||||||
#[fail(display="Continuation is not supproted.")]
|
#[fail(display="Continuation is not supported.")]
|
||||||
NoContinuation,
|
NoContinuation,
|
||||||
/// Bad utf-8 encoding
|
/// Bad utf-8 encoding
|
||||||
#[fail(display="Bad utf-8 encoding.")]
|
#[fail(display="Bad utf-8 encoding.")]
|
||||||
|
Loading…
Reference in New Issue
Block a user