mirror of https://github.com/fafhrd91/actix-web
fix limit not working on HttpMessage::limit
This commit is contained in:
parent
c201c15f8c
commit
8a155fa5ef
|
@ -196,7 +196,7 @@ fn bytes_to_string(body: Bytes, encoding: &'static Encoding) -> Result<String, E
|
||||||
/// `.app_data()` methods.
|
/// `.app_data()` methods.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct PayloadConfig {
|
pub struct PayloadConfig {
|
||||||
limit: usize,
|
pub limit: usize,
|
||||||
mimetype: Option<Mime>,
|
mimetype: Option<Mime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,9 +316,11 @@ impl HttpMessageBody {
|
||||||
/// Change max size of payload. By default max size is 256kB
|
/// Change max size of payload. By default max size is 256kB
|
||||||
pub fn limit(mut self, limit: usize) -> Self {
|
pub fn limit(mut self, limit: usize) -> Self {
|
||||||
if let Some(l) = self.length {
|
if let Some(l) = self.length {
|
||||||
if l > limit {
|
self.err = if l > limit {
|
||||||
self.err = Some(PayloadError::Overflow);
|
Some(PayloadError::Overflow)
|
||||||
}
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
}
|
}
|
||||||
self.limit = limit;
|
self.limit = limit;
|
||||||
self
|
self
|
||||||
|
|
Loading…
Reference in New Issue