Closed Ploppz closed 4 years ago
This is expected behavior. src/types/json.rs
Json extractor would only look for a JsonConfig
type from the app_data. If you wrap the JsonConfig
in App::data
and it make it a Data<JsonConfig>
type. So just wrap it directly with App::app_data
and ignore the Data
wrapper type and it would work.
This bring up a point tough. Should we offer a dumb proof check like this in the future for certain data types like
req.app_data::<T>()
.or_else(||req.app_data::<Data<T>>().map(Data::get_ref))
I feel trying both T
and Data<T>
be a good solution to the confusion with extractor configs.
@Ploppz Try using .app_data()
instead of .data()
for the JsonConfig
:
HttpServer::new(move || {
App::new()
.wrap(actix_web::middleware::Logger::new(
"%a \"%r\" (size: %{Content-Length}i) Response: %s %b",
))
.app_data(web::JsonConfig::default().limit(1024 * 1024 * 50))
going to close this because since #1610 was merged
actix-web version:
3.0.0-alpha.3
My App starts with
This is the signature of the request handler I invoke:
This is what it logs when I send about 5MB of payload:
Where the format of the Logger middleware is set to
"%a \"%r\" (size: %{Content-Length}i) Response: %s %b"
.