mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
consistent naming
This commit is contained in:
@ -36,7 +36,7 @@ fn index_async(req: HttpRequest) -> Once<actix_web::Frame, Error>
|
||||
{
|
||||
println!("{:?}", req);
|
||||
|
||||
once(Ok(HttpResponse::builder(StatusCode::OK)
|
||||
once(Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("text/html")
|
||||
.body(format!("Hello {}!", req.match_info().get("name").unwrap()))
|
||||
.unwrap()
|
||||
@ -48,7 +48,7 @@ fn with_param(req: HttpRequest) -> Result<HttpResponse>
|
||||
{
|
||||
println!("{:?}", req);
|
||||
|
||||
Ok(HttpResponse::builder(StatusCode::OK)
|
||||
Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("test/plain")
|
||||
.body(format!("Hello {}!", req.match_info().get("name").unwrap()))?)
|
||||
}
|
||||
@ -79,7 +79,7 @@ fn main() {
|
||||
println!("{:?}", req);
|
||||
|
||||
Ok(httpcodes::HTTPFound
|
||||
.builder()
|
||||
.build()
|
||||
.header("LOCATION", "/index.html")
|
||||
.body(Body::Empty)?)
|
||||
}))
|
||||
|
@ -12,7 +12,7 @@ use actix_web::*;
|
||||
fn index(req: HttpRequest) -> HttpResponse {
|
||||
println!("{:?}", req);
|
||||
httpcodes::HTTPOk
|
||||
.builder()
|
||||
.build()
|
||||
.content_type("text/plain")
|
||||
.body("Welcome!").unwrap()
|
||||
}
|
||||
@ -38,7 +38,7 @@ fn main() {
|
||||
// with path parameters
|
||||
.resource("/", |r| r.handler(Method::GET, |req| {
|
||||
Ok(httpcodes::HTTPFound
|
||||
.builder()
|
||||
.build()
|
||||
.header("LOCATION", "/index.html")
|
||||
.body(Body::Empty)?)
|
||||
})))
|
||||
|
@ -212,7 +212,7 @@ fn main() {
|
||||
.resource("/", |r|
|
||||
r.handler(Method::GET, |req| {
|
||||
Ok(httpcodes::HTTPFound
|
||||
.builder()
|
||||
.build()
|
||||
.header("LOCATION", "/static/websocket.html")
|
||||
.body(Body::Empty)?)
|
||||
}))
|
||||
|
Reference in New Issue
Block a user