feat(core): Default encoding/decoding limits (#1335)
* feat(core): Default encoding/decoding limits This PR adds new defaults for both client and server max encoding/decoding message size limits. By default, the max message decoding size is `4MB` and the max message encoding size is `usize::MAX`. This is follow up work from https://github.com/hyperium/tonic/pull/1274 BREAKING: Default max message encoding/decoding limits * update generated code
This commit is contained in:
@@ -136,6 +136,8 @@ pub(crate) fn generate_internal<T: Service>(
|
||||
}
|
||||
|
||||
/// Limits the maximum size of a decoded message.
|
||||
///
|
||||
/// Default: `4MB`
|
||||
#[must_use]
|
||||
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
||||
self.inner = self.inner.max_decoding_message_size(limit);
|
||||
@@ -143,6 +145,8 @@ pub(crate) fn generate_internal<T: Service>(
|
||||
}
|
||||
|
||||
/// Limits the maximum size of an encoded message.
|
||||
///
|
||||
/// Default: `usize::MAX`
|
||||
#[must_use]
|
||||
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
||||
self.inner = self.inner.max_encoding_message_size(limit);
|
||||
|
||||
@@ -84,6 +84,8 @@ pub(crate) fn generate_internal<T: Service>(
|
||||
|
||||
let configure_max_message_size_methods = quote! {
|
||||
/// Limits the maximum size of a decoded message.
|
||||
///
|
||||
/// Default: `4MB`
|
||||
#[must_use]
|
||||
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
||||
self.max_decoding_message_size = Some(limit);
|
||||
@@ -91,6 +93,8 @@ pub(crate) fn generate_internal<T: Service>(
|
||||
}
|
||||
|
||||
/// Limits the maximum size of an encoded message.
|
||||
///
|
||||
/// Default: `usize::MAX`
|
||||
#[must_use]
|
||||
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
||||
self.max_encoding_message_size = Some(limit);
|
||||
|
||||
Reference in New Issue
Block a user