1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

upgrade to beta3

This commit is contained in:
Nikolay Kim
2019-05-04 21:52:24 -07:00
parent d571ee5abb
commit 8de183768c
33 changed files with 70 additions and 80 deletions

View File

@ -6,7 +6,7 @@ workspace = ".."
edition = "2018"
[dependencies]
actix-web = "1.0.0-alpha.4"
actix-web = "1.0.0-beta.3"
bytes = "0.4"
env_logger = "0.6"

View File

@ -137,22 +137,20 @@ fn main() -> std::io::Result<()> {
// Use of the extractors makes some post conditions simpler such
// as size limit protections and built in json validation.
.service(
web::resource("/add2").route(
web::post()
.data(
web::JsonConfig::default()
.limit(4096) // <- limit size of the payload
.error_handler(|err, _| {
// <- create custom error response
error::InternalError::from_response(
err,
HttpResponse::Conflict().finish(),
)
.into()
}),
)
.to_async(add2),
),
web::resource("/add2")
.data(
web::JsonConfig::default()
.limit(4096) // <- limit size of the payload
.error_handler(|err, _| {
// <- create custom error response
error::InternalError::from_response(
err,
HttpResponse::Conflict().finish(),
)
.into()
}),
)
.route(web::post().to_async(add2)),
)
// Manual parsing would allow custom error construction, use of
// other parsers *beside* json (for example CBOR, protobuf, xml), and allows