INNER CODE UNIT · Python

_response_headers

akutayural/APIException · api_exception/__init__.py:331

    def _response_headers(req: Request) -> Dict[str, str]:
        if not _response_header_keys:
            return {}
        return _collect_headers(req, _response_header_keys)

    # ---- handlers ------------------------------------------------------------

    @app.exception_handler(APIException)
    async def api_exception_handler(request: Request, exc: APIException):
        # Central place to log raised APIException
        if log and getattr(exc, "log_exception", True) is True:
            meta: Dict[str, Any] = {
                "event": "api_exception",
                "path": request.url.path,
                "method": request.method,
                "client_ip": request.client.host if request.client else "unknown",
                "http_version": request.scope.get("http_version", None),
                "error_code": getattr(exc, "error_code", None),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…