-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set Byte payload config #1469
Comments
Wait... can you not have a stateful app, and also configure route upload settings? I got it working if i do the app_data at the App level but it doesn't work at the service level. How do i get different configs at the service level |
Could you try using FromRequest::configure for it? Something like: .app_data(actix_web::web::Bytes::configure(|cfg| {
cfg.limit(1000000 * 250) // Set max file size to 6 Mib
})) Documentation for JsonConfigure has a more complete example for it. |
I get the same error about app data not being configured if i do that. I believe this is because service app_data overrides app level app_data but i am not sure. I have to add the config as an app level config but that effects all routes. |
@robjtede i know you did some work with this data layer stuff. Is the behavior i am seeing expected. A working configuration is:
The json config must be specified at the top level .app_data. If i move it to any route below i get a runtime error about data not being configured and it appears to 'unregister' my app_state.clone() data line. |
If you call HTTP client that will have response larger than 256kb then you should also set limit for that response e.g.
|
Just following up @stevemk14ebr, this might be solved by the changes made to data stacking in v3 beta. |
I believe this issue is fixed. Please open a new issue if further problems arise. |
I've opened a discussion on how to do this with actix-web 4: #2722 |
I cannot figure out how to set the payload limit for the Bytes type. I'm trying to use
But this gives an app_data is not configured error. If i do .data() on the app itself the payload limit is not respected and i get a 413: A payload reached size limit. I'm on the latest actix 2 version
The text was updated successfully, but these errors were encountered: