mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
upgrade to beta3
This commit is contained in:
@ -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"
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user