From 1b18c82dfaa1588ee0631c173dca89e830e414ad Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Fri, 12 Jan 2024 22:06:05 +0800 Subject: [PATCH] fix: set nginx 413 error as payload too large --- libs/client-api/src/http.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/client-api/src/http.rs b/libs/client-api/src/http.rs index a90126a7..db4646b9 100644 --- a/libs/client-api/src/http.rs +++ b/libs/client-api/src/http.rs @@ -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() }