fix: set nginx 413 error as payload too large

This commit is contained in:
Fu Zi Xiang 2024-01-12 22:06:05 +08:00
parent c9d2f4f9bd
commit 1b18c82dfa
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,7 @@ use gotrue::params::{AdminUserParams, GenerateLinkParams};
use mime::Mime;
use parking_lot::RwLock;
use realtime_entity::EncodedCollab;
use reqwest::{header, Body};
use reqwest::{header, Body, StatusCode};
use collab_entity::CollabType;
use reqwest::header::HeaderValue;
@ -1096,6 +1096,11 @@ impl Client {
.send()
.await?;
log_request_id(&resp);
if resp.status() == StatusCode::PAYLOAD_TOO_LARGE {
return Err(AppResponseError::from(AppError::PayloadTooLarge(
StatusCode::PAYLOAD_TOO_LARGE.to_string(),
)));
}
AppResponse::<()>::from_response(resp).await?.into_error()
}