forked from mtusi2026/mtusi2026lab3
feat: ЛР3 - Nginx балансировка, идемпотентность сообщений и failover
This commit is contained in:
+6
-1
@@ -9,6 +9,7 @@ from fastapi.responses import JSONResponse
|
||||
import redis.exceptions
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
|
||||
from app.config import INSTANCE_ID
|
||||
from app.schemas import ErrorCode, ErrorDetail, ErrorResponse
|
||||
|
||||
|
||||
@@ -56,7 +57,11 @@ def make_error_response(
|
||||
payload = ErrorResponse(
|
||||
error=ErrorDetail(code=code, message=message, request_id=request_id)
|
||||
).model_dump()
|
||||
resp_headers = {"X-Request-Id": request_id, "Content-Type": "application/json"}
|
||||
resp_headers = {
|
||||
"X-Request-Id": request_id,
|
||||
"X-Instance-Id": INSTANCE_ID,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
if headers:
|
||||
resp_headers.update(headers)
|
||||
return JSONResponse(
|
||||
|
||||
Reference in New Issue
Block a user