2# +==== BEGIN CatFeeder =================+
5# ...............)..(.')
7# ...............\(__)|
8# Inspired by Joan Stark
9# source https://www.asciiart.eu/
14# CREATION DATE: 11-10-2025
15# LAST Modified: 22:59:13 26-01-2026
17# This is the backend server in charge of making the actual website work.
19# COPYRIGHT: (c) Cat Feeder
20# PURPOSE: File containing the list of http codes that can be sent and received by the server.
22# +==== END CatFeeder =================+
26from typing
import Mapping, Dict, Any, Optional, Union, TypeAlias
28from fastapi.responses
import (
29 Response, FileResponse, HTMLResponse, JSONResponse,
30 PlainTextResponse, RedirectResponse, StreamingResponse,
31 UJSONResponse, ORJSONResponse
34from .
import http_constants
as CONST
35from ..core
import FinalClass
38ContentTypeLike: TypeAlias = Union[CONST.DataTypes, str]
42 """HTTP status code response handler using FastAPI response types.
44 Provides methods for returning standardized HTTP responses with appropriate
45 status codes, content types, and headers. Supports JSON, plain text, HTML,
46 binary, file, and redirect responses.
48 HTTP Response Categories:
63 """Validate and normalize provided content type to canonical MIME string.
65 Resolves content type from DataTypes enum member, known key string, or raw MIME type string to standardized MIME format.
68 data_type (ContentTypeLike, optional): Desired content type or alias.
71 str: Canonical MIME type string (e.g., "application/json").
74 TypeError: If the provided type cannot be resolved to a known or valid MIME type.
79 if isinstance(data_type, CONST.DataTypes):
80 return data_type.value
82 if isinstance(data_type, str):
83 resolved = CONST.DataTypes.from_key(data_type)
84 if resolved
is not None:
87 lowered = data_type.lower()
93 raise TypeError(f
"Invalid data type: {data_type}")
95 def _check_header(self, header: Optional[Mapping[str, str]] =
None) -> Any:
96 """Validate and normalize HTTP headers.
99 header (Mapping[str, str], optional): _description_. Defaults to None.
101 Any: Returns the correct known version of the sent headers.
103 TypeError: If header is not a Mapping or Dict.
107 if not isinstance(header, (Dict, Mapping)):
109 f
"Invalid header format, the format you provided is: {type(header)}"
114 """Process data content for HTTP response based on MIME type.
116 Handles binary passthrough, file-like objects, JSON, and streaming data.
119 data (Any): _description_: The data to be sent.
120 data_type (str): _description_: The type of the data to be sent.
123 Any: Processed data in appropriate format for response type.
128 if isinstance(data, (bytes, bytearray)):
131 if hasattr(data,
"read"):
134 if data_type
in CONST.JSON_MIME_TYPES:
137 if data_type
in CONST.STREAMING_MIME_TYPES:
141 def _package_correctly(self, status: int = 200, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Union[Response, FileResponse, HTMLResponse, JSONResponse, PlainTextResponse, RedirectResponse, StreamingResponse, UJSONResponse, ORJSONResponse]:
142 """Route response content to appropriate FastAPI response class.
144 Determines correct response type based on content type and returns properly formatted response with status code, content, type, and headers.
147 status (int, optional): HTTP status code. Defaults to 200.
148 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
149 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
150 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
153 TypeError: If content type is incompatible with content.
156 Union[Response, FileResponse, HTMLResponse, JSONResponse, PlainTextResponse,
157 RedirectResponse, StreamingResponse, UJSONResponse, ORJSONResponse]: _description_
160 if isinstance(content, bytes):
165 media_type=content_type
169 if content_type
in CONST.STREAMING_MIME_TYPES:
171 return StreamingResponse(
175 media_type=content_type
179 if content_type
in CONST.FILE_MIME_TYPES:
180 if not isinstance(content, str):
182 "FileResponse requires the content to be a file path string."
185 if not os.path.isfile(content):
190 media_type=content_type
196 media_type=content_type,
197 filename=os.path.basename(content)
201 if content_type
in CONST.HTML_MIME_TYPES:
206 media_type=content_type
210 if content_type
in CONST.JSON_MIME_TYPES:
215 media_type=content_type
219 if content_type
in CONST.PLAIN_TEXT_MIME_TYPES:
220 return PlainTextResponse(
224 media_type=content_type
228 if content_type
in CONST.REDIRECT_MIME_TYPES:
229 return RedirectResponse(
236 if content_type
in CONST.UJSON_MIME_TYPES:
237 return UJSONResponse(
241 media_type=content_type
245 if content_type
in CONST.ORJSON_MIME_TYPES:
246 return ORJSONResponse(
250 media_type=content_type
258 media_type=content_type
261 def send_message_on_status(self, status: int = 200, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
262 """Send HTTP response with specified status code and content.
265 status (int, optional): HTTP status code. Defaults to 200.
266 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
267 content_type (ContentTypeLike, optional): MIME type as DataTypes, known key, or string. Defaults to DEFAULT_MESSAGE_TYPE.
268 headers (Mapping[str, str], optional): HTTP headers mapping. Defaults to None.
271 ValueError: If status code is not authorized.
274 Response: FastAPI response object.
277 if isinstance(status, str)
and status.isdigit():
281 raise ValueError(f
"Invalid HTTP status code: {status}")
288 if isinstance(status, str)
and status.isnumeric():
293 f
"Invalid status code, the code you entered is: {status}"
300 content_type=data_type,
306 def send_continue(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
307 """Send 100 Continue HTTP response.
309 Indicates initial part of request received; client should continue or ignore if already finished.
312 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
313 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
314 headers (Mapping[str,str], optional): HTTP headers mapping. Defaults to None.
317 Response: A FastAPI Response object with status 100.
319 return self.
send_message_on_status(status=100, content=content, content_type=content_type, headers=headers)
321 def switching_protocols(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
322 """Send 101 Switching Protocols HTTP response.
324 Server switches protocols as requested by client, typically for WebSocket.
327 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
328 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
329 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
332 Response: FastAPI Response object with status 101.
334 return self.
send_message_on_status(status=101, content=content, content_type=content_type, headers=headers)
336 def processing(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
337 """Send 102 Processing HTTP response.
339 Server has received and is processing request; no response available yet. Commonly used in WebDAV.
342 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
343 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
344 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
347 Response: FastAPI Response object with status 102.
349 return self.
send_message_on_status(status=102, content=content, content_type=content_type, headers=headers)
351 def early_hints(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
352 """Send 103 Early Hints HTTP response.
354 Preload resources while server prepares final response. Improves page load.
357 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
358 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
359 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
362 Response: FastAPI Response object with status 103.
364 return self.
send_message_on_status(status=103, content=content, content_type=content_type, headers=headers)
366 def response_is_stale(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
367 """Send 110 Response Is Stale HTTP response.
369 Cached response is stale but still usable. Used in caching scenarios.
372 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
373 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
374 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
377 Response: FastAPI Response object with status 110.
379 return self.
send_message_on_status(status=110, content=content, content_type=content_type, headers=headers)
383 def success(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
384 """Send 200 OK HTTP response.
386 Request succeeded. Meaning depends on HTTP method (GET, POST, etc.).
389 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
390 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
391 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
394 Response: FastAPI Response object with status 200.
396 return self.
send_message_on_status(status=200, content=content, content_type=content_type, headers=headers)
398 def created(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
399 """Send 201 Created HTTP response.
401 Request fulfilled; new resource created.
404 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
405 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
406 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
409 Response: FastAPI Response object with status 201.
411 return self.
send_message_on_status(status=201, content=content, content_type=content_type, headers=headers)
413 def accepted(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
414 """Send 202 Accepted HTTP response.
416 Request accepted for processing but not yet completed. Used for async ops.
419 content (Any, optional): Response content. Defaults to DEFAULT_MESSAGE_CONTENT.
420 content_type (ContentTypeLike, optional): MIME type or DataTypes member. Defaults to DEFAULT_MESSAGE_TYPE.
421 headers (Optional[Mapping[str, str]], optional): HTTP headers mapping. Defaults to None.
424 Response: FastAPI Response object with status 202.
426 return self.
send_message_on_status(status=202, content=content, content_type=content_type, headers=headers)
428 def non_authoritative_information(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
429 """Send 203 Non-Authoritative Information HTTP response.
432 returned info from third-party source.
435 content_type: MIME type or DataTypes member.
436 Defaults to DEFAULT_MESSAGE_TYPE.
437 content(Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
438 content_type(ContentTypeLike, optional): Content type as `DataTypes` member, known key(e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
439 headers(Mapping[str, str], optional): Additional headers to include. Defaults to None.
442 Response: A FastAPI Response object with status 203.
444 return self.
send_message_on_status(status=203, content=content, content_type=content_type, headers=headers)
446 def no_content(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
448 Send a 204 No Content HTTP response.
450 This response indicates that the server successfully processed the request,
451 but is not returning any content. Typically used for DELETE operations.
454 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
455 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
456 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
459 Response: A FastAPI Response object with status 204.
461 return self.
send_message_on_status(status=204, content=content, content_type=content_type, headers=headers)
463 def reset_content(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
465 Send a 205 Reset Content HTTP response.
467 This response indicates that the server successfully processed the request,
468 and the user agent should reset the document view.
471 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
472 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
473 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
476 Response: A FastAPI Response object with status 205.
478 return self.
send_message_on_status(status=205, content=content, content_type=content_type, headers=headers)
480 def partial_content(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
482 Send a 206 Partial Content HTTP response.
484 This response indicates that the server is delivering only part of the
485 resource due to a range header sent by the client.
488 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
489 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
490 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
493 Response: A FastAPI Response object with status 206.
495 return self.
send_message_on_status(status=206, content=content, content_type=content_type, headers=headers)
497 def multi_status(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
499 Send a 207 Multi-Status HTTP response.
501 Used by WebDAV to convey status for multiple independent sub-requests
502 (e.g., batch file operations). The response body typically enumerates
503 individual resource states with their own status codes. Prefer this
504 when returning heterogeneous results for a single compound action.
507 content (Any, optional): Structured status description (often JSON/XML). Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
508 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
509 headers (Mapping[str, str], optional): Extra response headers. Defaults to None.
512 Response: FastAPI Response object with status 207.
514 return self.
send_message_on_status(status=207, content=content, content_type=content_type, headers=headers)
516 def already_reported(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
518 Send a 208 Already Reported HTTP response.
520 WebDAV specific: indicates members of a DAV binding have already been
521 listed in a previous multi-status response and need not be repeated.
522 Helps reduce payload duplication in complex collection listings.
525 content (Any, optional): Optional explanatory payload. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
526 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
527 headers (Mapping[str, str], optional): Extra response headers. Defaults to None.
530 Response: FastAPI Response object with status 208.
532 return self.
send_message_on_status(status=208, content=content, content_type=content_type, headers=headers)
534 def im_used(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
536 Send a 226 IM Used HTTP response.
538 Indicates the server fulfilled a GET using instance manipulations (e.g.,
539 delta encoding) applied to the current instance. Rarely used; applicable
540 when returning transformed representations rather than originals to
544 content (Any, optional): The manipulated representation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
545 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
546 headers (Mapping[str, str], optional): Extra response headers detailing transformations. Defaults to None.
549 Response: FastAPI Response object with status 226.
551 return self.
send_message_on_status(status=226, content=content, content_type=content_type, headers=headers)
553 """ 3xx redirection """
555 def multiple_choices(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
557 Send a 300 Multiple Choices HTTP response.
559 Indicates multiple possible representations / endpoints for the resource
560 (e.g., different file formats or language variants). Provide a body or
561 headers (like `Link`) to guide client selection. Avoid if automated
562 negotiation can resolve the choice.
565 content (Any, optional): Description of available choices. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
566 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
567 headers (Mapping[str, str], optional): Optional navigation metadata. Defaults to None.
570 Response: FastAPI Response object with status 300.
572 return self.
send_message_on_status(status=300, content=content, content_type=content_type, headers=headers)
574 def moved_permanently(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
576 Send a 301 Moved Permanently HTTP response.
578 Indicates the resource has a new canonical URI. Clients should update
579 bookmarks and future requests. Use for stable, long-term relocations.
580 Supply `Location` header pointing to the new URI.
583 content (Any, optional): Optional explanatory note. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
584 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
585 headers (Mapping[str, str], optional): Should include a `Location` header. Defaults to None.
588 Response: FastAPI Response object with status 301.
590 return self.
send_message_on_status(status=301, content=content, content_type=content_type, headers=headers)
592 def found(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
594 Send a 302 Found (Temporary Redirect) HTTP response.
596 Historically ambiguous; modern semantics suggest temporary relocation.
597 Client should continue using original URI for future requests. Provide
598 `Location` header. Prefer 307 if preserving method matters.
601 content (Any, optional): Optional details about redirect. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
602 content_type (str, optional): Media type for the body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
603 headers (Mapping[str, str], optional): Include `Location`. Defaults to None.
606 Response: FastAPI Response object with status 302.
608 return self.
send_message_on_status(status=302, content=content, content_type=content_type, headers=headers)
610 def see_other(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
612 Send a 303 See Other HTTP response.
614 Directs client to retrieve a representation from a different URI using
615 GET. Common after POST to show resulting resource or status page.
616 Include `Location` header.
619 content (Any, optional): Optional redirect explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
620 content_type (str, optional): Media type for body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
621 headers (Mapping[str, str], optional): Should include `Location`. Defaults to None.
624 Response: FastAPI Response object with status 303.
626 return self.
send_message_on_status(status=303, content=content, content_type=content_type, headers=headers)
628 def not_modified(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
630 Send a 304 Not Modified HTTP response.
632 Indicates conditional GET found resource unchanged; client should use
633 cached version. Do not include a body. Must accompany relevant caching
634 headers (ETag / Last-Modified previously supplied).
637 content (Any, optional): Ignored; body omitted. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
638 content_type (str, optional): Ignored. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
639 headers (Mapping[str, str], optional): May include cache validators. Defaults to None.
642 Response: FastAPI Response object with status 304.
644 return self.
send_message_on_status(status=304, content=content, content_type=content_type, headers=headers)
646 def use_proxy(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
648 Send a 305 Use Proxy HTTP response.
650 Deprecated in modern HTTP; originally indicated resource must be
651 accessed through a specified proxy. Avoid using; retain only for legacy
652 compatibility contexts.
655 content (Any, optional): Advisory note. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
656 content_type (str, optional): Media type for body. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
657 headers (Mapping[str, str], optional): Legacy metadata. Defaults to None.
660 Response: FastAPI Response object with status 305.
662 return self.
send_message_on_status(status=305, content=content, content_type=content_type, headers=headers)
664 def switch_proxy(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
666 Send a 306 Switch Proxy HTTP response.
668 Reserved / unused status code kept for historical reasons. Should not
669 appear in new applications. Provided here for completeness.
672 content (Any, optional): Typically empty. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
673 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
674 headers (Mapping[str, str], optional): Headers map. Defaults to None.
677 Response: FastAPI Response object with status 306.
679 return self.
send_message_on_status(status=306, content=content, content_type=content_type, headers=headers)
681 def temporary_redirect(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
683 Send a 307 Temporary Redirect HTTP response.
685 Indicates resource temporarily at another URI; original method and body
686 must be reused. Safer than 302 for non-GET requests. Include `Location`.
689 content (Any, optional): Optional description. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
690 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
691 headers (Mapping[str, str], optional): Must include `Location`. Defaults to None.
694 Response: FastAPI Response object with status 307.
696 return self.
send_message_on_status(status=307, content=content, content_type=content_type, headers=headers)
698 def permanent_redirect(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
700 Send a 308 Permanent Redirect HTTP response.
702 Resource permanently moved; future requests should use new URI. Unlike
703 301, preserves method and body. Include `Location` header and migrate
707 content (Any, optional): Optional explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
708 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
709 headers (Mapping[str, str], optional): Should include `Location`. Defaults to None.
712 Response: FastAPI Response object with status 308.
714 return self.
send_message_on_status(status=308, content=content, content_type=content_type, headers=headers)
716 """ 4xx client error """
718 def bad_request(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
720 Send a 400 Bad Request HTTP response.
722 This response indicates that the server cannot process the request due to
723 client error (e.g., malformed request syntax, invalid request message framing,
724 or deceptive request routing).
727 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
728 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
729 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
732 Response: A FastAPI Response object with status 400.
734 return self.
send_message_on_status(status=400, content=content, content_type=content_type, headers=headers)
736 def unauthorized(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
738 Send a 401 Unauthorized HTTP response.
740 This response indicates that the request requires user authentication.
741 The client should authenticate itself to get the requested response.
744 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
745 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
746 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
749 Response: A FastAPI Response object with status 401.
751 return self.
send_message_on_status(status=401, content=content, content_type=content_type, headers=headers)
753 def payment_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
755 Send a 402 Payment Required HTTP response.
757 Reserved for future digital payment flows; occasionally repurposed for
758 quota or subscription enforcement. Provide actionable guidance for
759 completing payment or upgrading.
762 content (Any, optional): Payment or upgrade instructions. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
763 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
764 headers (Mapping[str, str], optional): May include billing references. Defaults to None.
767 Response: FastAPI Response object with status 402.
769 return self.
send_message_on_status(status=402, content=content, content_type=content_type, headers=headers)
771 def forbidden(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
773 Send a 403 Forbidden HTTP response.
775 Indicates authenticated client lacks permission for the target resource.
776 Use for authorization failures (role / ACL issues). Do not reveal
777 sensitive existence details beyond necessity.
780 content (Any, optional): Permission denial explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
781 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
782 headers (Mapping[str, str], optional): Additional security headers. Defaults to None.
785 Response: FastAPI Response object with status 403.
787 return self.
send_message_on_status(status=403, content=content, content_type=content_type, headers=headers)
789 def not_found(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
791 Send a 404 Not Found HTTP response.
793 Indicates the server cannot locate the target resource. Use for missing
794 identifiers, deleted objects, or invalid routes. Avoid leaking internal
795 structure; keep messages generic for security-sensitive contexts.
798 content (Any, optional): User-facing explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
799 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
800 headers (Mapping[str, str], optional): Headers map. Defaults to None.
803 Response: FastAPI Response object with status 404.
805 return self.
send_message_on_status(status=404, content=content, content_type=content_type, headers=headers)
807 def method_not_allowed(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
809 Send a 405 Method Not Allowed HTTP response.
811 Method exists but is not permitted for this resource (e.g., POST on a
812 read-only endpoint). Include an `Allow` header enumerating supported
816 content (Any, optional): Optional guidance. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
817 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
818 headers (Mapping[str, str], optional): Should include `Allow`. Defaults to None.
821 Response: FastAPI Response object with status 405.
823 return self.
send_message_on_status(status=405, content=content, content_type=content_type, headers=headers)
825 def not_acceptable(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
827 Send a 406 Not Acceptable HTTP response.
829 Indicates server cannot produce a representation matching client's
830 proactive content negotiation headers. Suggest alternative formats when
834 content (Any, optional): Negotiation failure details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
835 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
836 headers (Mapping[str, str], optional): May include `Vary`. Defaults to None.
839 Response: FastAPI Response object with status 406.
841 return self.
send_message_on_status(status=406, content=content, content_type=content_type, headers=headers)
843 def proxy_authentication_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
845 Send a 407 Proxy Authentication Required HTTP response.
847 Client must authenticate with a proxy before request can proceed.
848 Include `Proxy-Authenticate` challenge. Similar flow to 401 but for
852 content (Any, optional): Challenge/description. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
853 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
854 headers (Mapping[str, str], optional): Should include `Proxy-Authenticate`. Defaults to None.
857 Response: FastAPI Response object with status 407.
859 return self.
send_message_on_status(status=407, content=content, content_type=content_type, headers=headers)
861 def request_timeout(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
863 Send a 408 Request Timeout HTTP response.
865 Server terminated an idle connection because the client did not produce
866 a complete request in time. Client may retry. Consider adjusting timeouts
870 content (Any, optional): Timeout explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
871 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
872 headers (Mapping[str, str], optional): Headers map. Defaults to None.
875 Response: FastAPI Response object with status 408.
877 return self.
send_message_on_status(status=408, content=content, content_type=content_type, headers=headers)
879 def conflict(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
881 Send a 409 Conflict HTTP response.
883 Indicates request conflicts with current resource state (e.g., version
884 mismatch, duplicate unique field). Provide resolution instructions or a
885 representation of the current state.
888 content (Any, optional): Conflict description. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
889 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
890 headers (Mapping[str, str], optional): May include `ETag`. Defaults to None.
893 Response: FastAPI Response object with status 409.
895 return self.
send_message_on_status(status=409, content=content, content_type=content_type, headers=headers)
897 def gone(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
899 Send a 410 Gone HTTP response.
901 Resource intentionally removed and no forwarding address known. Different
902 from 404 by permanence. Useful for deprecated APIs or purged content.
905 content (Any, optional): Removal explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
906 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
907 headers (Mapping[str, str], optional): Headers map. Defaults to None.
910 Response: FastAPI Response object with status 410.
912 return self.
send_message_on_status(status=410, content=content, content_type=content_type, headers=headers)
914 def length_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
916 Send a 411 Length Required HTTP response.
918 Server refuses request without a valid `Content-Length` header when one
919 is mandated. Client should resend with explicit length.
922 content (Any, optional): Instruction to include length. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
923 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
924 headers (Mapping[str, str], optional): Headers map. Defaults to None.
927 Response: FastAPI Response object with status 411.
929 return self.
send_message_on_status(status=411, content=content, content_type=content_type, headers=headers)
931 def precondition_failed(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
933 Send a 412 Precondition Failed HTTP response.
935 One or more conditional request headers (If-Match, If-Unmodified-Since)
936 did not match resource state, aborting the operation. Client should
937 refetch representation and retry.
940 content (Any, optional): Failed condition explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
941 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
942 headers (Mapping[str, str], optional): May include updated validators. Defaults to None.
945 Response: FastAPI Response object with status 412.
947 return self.
send_message_on_status(status=412, content=content, content_type=content_type, headers=headers)
949 def payload_too_large(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
951 Send a 413 Payload Too Large HTTP response.
953 Request entity exceeds server limits (size caps, upload restrictions).
954 Provide maximum allowed size to assist client correction.
957 content (Any, optional): Size limit details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
958 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
959 headers (Mapping[str, str], optional): May include limit hints. Defaults to None.
962 Response: FastAPI Response object with status 413.
964 return self.
send_message_on_status(status=413, content=content, content_type=content_type, headers=headers)
966 def uri_too_long(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
968 Send a 414 URI Too Long HTTP response.
970 Target URI exceeds server parsing or policy limits (often due to huge
971 query strings). Recommend switching to POST with body parameters.
974 content (Any, optional): Advisory message. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
975 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
976 headers (Mapping[str, str], optional): Headers map. Defaults to None.
979 Response: FastAPI Response object with status 414.
981 return self.
send_message_on_status(status=414, content=content, content_type=content_type, headers=headers)
983 def unsupported_media_type(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
985 Send a 415 Unsupported Media Type HTTP response.
987 Request's `Content-Type` not supported for target resource (e.g., image
988 upload in unsupported format). List accepted types where feasible.
991 content (Any, optional): Supported formats guidance. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
992 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
993 headers (Mapping[str, str], optional): May include `Accept-Post`. Defaults to None.
996 Response: FastAPI Response object with status 415.
998 return self.
send_message_on_status(status=415, content=content, content_type=content_type, headers=headers)
1000 def range_not_satisfiable(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1002 Send a 416 Range Not Satisfiable HTTP response.
1004 Client requested a byte range outside resource bounds. Include a
1005 `Content-Range` header indicating valid size to guide retries.
1008 content (Any, optional): Range error details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1009 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1010 headers (Mapping[str, str], optional): Should include `Content-Range`. Defaults to None.
1013 Response: FastAPI Response object with status 416.
1015 return self.
send_message_on_status(status=416, content=content, content_type=content_type, headers=headers)
1017 def expectation_failed(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1019 Send a 417 Expectation Failed HTTP response.
1021 Server cannot meet requirements of the `Expect` request-header (commonly
1022 `100-continue`). Client should adjust headers or remove Expect.
1025 content (Any, optional): Explanation of unmet expectation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1026 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1027 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1030 Response: FastAPI Response object with status 417.
1032 return self.
send_message_on_status(status=417, content=content, content_type=content_type, headers=headers)
1034 def im_a_teapot(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1036 Send a 418 I'm a Teapot HTTP response.
1038 April Fools RFC (RFC 2324) humorous code. Occasionally used for rate
1039 limiting or easter eggs. Avoid in production protocols unless intentional.
1042 content (Any, optional): Playful message. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1043 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1044 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1047 Response: FastAPI Response object with status 418.
1049 return self.
send_message_on_status(status=418, content=content, content_type=content_type, headers=headers)
1051 def page_expired(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1053 Send a 419 Page Expired HTTP response.
1055 Non-standard code sometimes used to indicate expired session or CSRF
1056 token invalidation. Provide re-authentication or refresh guidance.
1059 content (Any, optional): Expiration details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1060 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1061 headers (Mapping[str, str], optional): May include session hints. Defaults to None.
1064 Response: FastAPI Response object with status 419.
1066 return self.
send_message_on_status(status=419, content=content, content_type=content_type, headers=headers)
1068 def enhance_your_calm(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1070 Send a 420 Enhance Your Calm HTTP response.
1072 Non-standard (Twitter usage) for rate limiting or abuse detection.
1073 Provide throttling window and retry-after guidance where possible.
1076 content (Any, optional): Rate limit explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1077 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1078 headers (Mapping[str, str], optional): May include `Retry-After`. Defaults to None.
1081 Response: FastAPI Response object with status 420.
1083 return self.
send_message_on_status(status=420, content=content, content_type=content_type, headers=headers)
1085 def misdirected_request(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1087 Send a 421 Misdirected Request HTTP response.
1089 Request was directed to a server incapable of producing a response (e.g.,
1090 SNI routing mismatch). Client should retry against correct origin.
1093 content (Any, optional): Routing error details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1094 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1095 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1098 Response: FastAPI Response object with status 421.
1100 return self.
send_message_on_status(status=421, content=content, content_type=content_type, headers=headers)
1102 def unprocessable_entity(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1104 Send a 422 Unprocessable Entity HTTP response.
1106 Syntax is correct but semantic validation failed (e.g., domain rules,
1107 constraint violations). Return structured field error details to aid
1111 content (Any, optional): Validation errors payload. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1112 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1113 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1116 Response: FastAPI Response object with status 422.
1118 return self.
send_message_on_status(status=422, content=content, content_type=content_type, headers=headers)
1120 def locked(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1122 Send a 423 Locked HTTP response.
1124 WebDAV: resource is locked and cannot be modified. Provide lock token or
1125 instructions for obtaining access if appropriate.
1128 content (Any, optional): Lock state description. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1129 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1130 headers (Mapping[str, str], optional): May include lock token reference. Defaults to None.
1133 Response: FastAPI Response object with status 423.
1135 return self.
send_message_on_status(status=423, content=content, content_type=content_type, headers=headers)
1137 def failed_dependency(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1139 Send a 424 Failed Dependency HTTP response.
1141 WebDAV: a method failed because a prior request on which it depended
1142 failed. Use in batch or chained operations to clarify cascading errors.
1145 content (Any, optional): Upstream failure details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1146 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1147 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1150 Response: FastAPI Response object with status 424.
1152 return self.
send_message_on_status(status=424, content=content, content_type=content_type, headers=headers)
1154 def too_early(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1156 Send a 425 Too Early HTTP response.
1158 Indicates server is unwilling to risk replay of a request that might be
1159 unsafe if repeated (e.g., early data in TLS 1.3). Client should resend
1163 content (Any, optional): Replay risk explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1164 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1165 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1168 Response: FastAPI Response object with status 425.
1170 return self.
send_message_on_status(status=425, content=content, content_type=content_type, headers=headers)
1172 def upgrade_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1174 Send a 426 Upgrade Required HTTP response.
1176 Client must switch to a different protocol (e.g., TLS, HTTP/2) to proceed.
1177 Include `Upgrade` header advertising acceptable protocols.
1180 content (Any, optional): Upgrade instructions. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1181 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1182 headers (Mapping[str, str], optional): Should include `Upgrade`. Defaults to None.
1185 Response: FastAPI Response object with status 426.
1187 return self.
send_message_on_status(status=426, content=content, content_type=content_type, headers=headers)
1189 def precondition_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1191 Send a 428 Precondition Required HTTP response.
1193 Server requires the request be conditional (e.g., to prevent lost updates
1194 in concurrent modifications). Client should include appropriate
1195 conditional headers (If-Match / If-Unmodified-Since).
1198 content (Any, optional): Instruction to add conditions. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1199 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1200 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1203 Response: FastAPI Response object with status 428.
1205 return self.
send_message_on_status(status=428, content=content, content_type=content_type, headers=headers)
1207 def too_many_requests(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1209 Send a 429 Too Many Requests HTTP response.
1211 Rate limiting triggered. Provide retry guidance via `Retry-After` or
1212 quota headers. Distinguish per-user vs global limits where relevant.
1215 content (Any, optional): Throttling explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1216 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1217 headers (Mapping[str, str], optional): Include rate limit metadata. Defaults to None.
1220 Response: FastAPI Response object with status 429.
1222 return self.
send_message_on_status(status=429, content=content, content_type=content_type, headers=headers)
1224 def request_header_fields_too_large(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1226 Send a 431 Request Header Fields Too Large HTTP response.
1228 One or more header fields exceed size limits (security or performance
1229 constraints). Client should reduce header volume (cookies, custom
1230 metadata) and retry.
1233 content (Any, optional): Reduction guidance. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1234 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1235 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1238 Response: FastAPI Response object with status 431.
1240 return self.
send_message_on_status(status=431, content=content, content_type=content_type, headers=headers)
1242 def unavailable_for_legal_reasons(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1244 Send a 451 Unavailable For Legal Reasons HTTP response.
1246 Resource unavailable due to legal demands (e.g., censorship, DMCA). Keep
1247 explanation minimal yet transparent. Avoid exposing sensitive legal
1248 references publicly.
1251 content (Any, optional): Legal restriction notice. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1252 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1253 headers (Mapping[str, str], optional): May include policy links. Defaults to None.
1256 Response: FastAPI Response object with status 451.
1258 return self.
send_message_on_status(status=451, content=content, content_type=content_type, headers=headers)
1260 def invalid_token(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] =
None) -> Response:
1262 Send a 498 Invalid Token HTTP response.
1264 Non-standard code occasionally used when token (API key / session) is
1265 malformed or expired but distinct from 401 semantics. Provide refresh
1266 / re-authentication instructions.
1269 content (Any, optional): Token validity explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1270 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1271 headers (Mapping[str, str], optional): May include security hints. Defaults to None.
1274 Response: FastAPI Response object with status 498.
1276 return self.
send_message_on_status(status=498, content=content, content_type=content_type, headers=headers)
1278 """ 5xx server error"""
1280 def internal_server_error(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1282 Send a 500 Internal Server Error HTTP response.
1284 This response indicates that the server encountered an unexpected condition
1285 that prevented it from fulfilling the request.
1288 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1289 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1290 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
1293 Response: A FastAPI Response object with status 500.
1295 return self.send_message_on_status(status=500, content=content, content_type=content_type, headers=headers)
1297 def not_implemented(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1299 Send a 501 Not Implemented HTTP response.
1301 This response indicates that the server does not support the functionality
1302 required to fulfill the request.
1305 content (Any, optional): The content to send. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1306 content_type (ContentTypeLike, optional): Content type as `DataTypes` member, known key (e.g., "json"), or raw MIME string. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1307 headers (Mapping[str, str], optional): Additional headers to include. Defaults to None.
1310 Response: A FastAPI Response object with status 501.
1312 return self.send_message_on_status(status=501, content=content, content_type=content_type, headers=headers)
1314 def bad_gateway(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1316 Send a 502 Bad Gateway HTTP response.
1318 Upstream server returned an invalid / error response to a gateway or
1319 proxy. Client may retry; investigate upstream health. Include minimal
1320 diagnostic context if safe.
1323 content (Any, optional): Upstream failure summary. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1324 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1325 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1328 Response: FastAPI Response object with status 502.
1330 return self.send_message_on_status(status=502, content=content, content_type=content_type, headers=headers)
1332 def service_unavailable(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1334 Send a 503 Service Unavailable HTTP response.
1336 Server temporarily unable to handle the request (maintenance / overload).
1337 Provide `Retry-After` if known. Differentiate transient from permanent
1341 content (Any, optional): Downtime notice. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1342 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1343 headers (Mapping[str, str], optional): May include `Retry-After`. Defaults to None.
1346 Response: FastAPI Response object with status 503.
1348 return self.send_message_on_status(status=503, content=content, content_type=content_type, headers=headers)
1350 def gateway_timeout(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1352 Send a 504 Gateway Timeout HTTP response.
1354 Upstream server failed to respond in time to a gateway / proxy. Client
1355 may retry with backoff. Monitor latency and circuit breaker thresholds.
1358 content (Any, optional): Timeout context. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1359 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1360 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1363 Response: FastAPI Response object with status 504.
1365 return self.send_message_on_status(status=504, content=content, content_type=content_type, headers=headers)
1367 def http_version_not_supported(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1369 Send a 505 HTTP Version Not Supported HTTP response.
1371 Server rejects requested HTTP protocol version. Advise supported versions
1372 (e.g., HTTP/1.1, HTTP/2). Could imply need for TLS upgrade pathway.
1375 content (Any, optional): Supported version info. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1376 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1377 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1380 Response: FastAPI Response object with status 505.
1382 return self.send_message_on_status(status=505, content=content, content_type=content_type, headers=headers)
1384 def variant_also_negotiates(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1386 Send a 506 Variant Also Negotiates HTTP response.
1388 Internal configuration error: content negotiation process is itself
1389 negotiated recursively. Rare; indicates misconfigured server variant
1393 content (Any, optional): Diagnostic hint. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1394 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1395 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1398 Response: FastAPI Response object with status 506.
1400 return self.send_message_on_status(status=506, content=content, content_type=content_type, headers=headers)
1402 def insufficient_storage(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1404 Send a 507 Insufficient Storage HTTP response.
1406 WebDAV / extension: server cannot store the representation needed to
1407 complete the request. Suggest freeing space or upgrading quotas.
1410 content (Any, optional): Storage limitation explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1411 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1412 headers (Mapping[str, str], optional): May include quota metadata. Defaults to None.
1415 Response: FastAPI Response object with status 507.
1417 return self.send_message_on_status(status=507, content=content, content_type=content_type, headers=headers)
1419 def loop_detected(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1421 Send a 508 Loop Detected HTTP response.
1423 WebDAV: infinite loop encountered while processing a request (e.g.,
1424 cyclic bindings). Client should adjust request path or structure.
1427 content (Any, optional): Loop diagnostic. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1428 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1429 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1432 Response: FastAPI Response object with status 508.
1434 return self.send_message_on_status(status=508, content=content, content_type=content_type, headers=headers)
1436 def bandwidth_limit_exceeded(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1438 Send a 509 Bandwidth Limit Exceeded HTTP response.
1440 Non-standard: hosting provider quota surpassed. Provide reset window or
1441 upgrade path. Distinguish from transient network congestion.
1444 content (Any, optional): Bandwidth quota details. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1445 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1446 headers (Mapping[str, str], optional): May include usage metrics. Defaults to None.
1449 Response: FastAPI Response object with status 509.
1451 return self.send_message_on_status(status=509, content=content, content_type=content_type, headers=headers)
1453 def not_extended(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1455 Send a 510 Not Extended HTTP response.
1457 Further extensions to the request are required for it to be fulfilled
1458 (e.g., additional protocol capabilities). Rare; provide explicit next
1462 content (Any, optional): Extension requirement explanation. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1463 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1464 headers (Mapping[str, str], optional): Headers map. Defaults to None.
1467 Response: FastAPI Response object with status 510.
1469 return self.send_message_on_status(status=510, content=content, content_type=content_type, headers=headers)
1471 def network_authentication_required(self, content: Any = CONST.DEFAULT_MESSAGE_CONTENT, *, content_type: ContentTypeLike = CONST.DEFAULT_MESSAGE_TYPE, headers: Optional[Mapping[str, str]] = None) -> Response:
1473 Send a 511 Network Authentication Required HTTP response.
1475 Client must authenticate to gain network access (e.g., captive portal).
1476 Provide login or acceptance instructions. After completion, original
1477 request can be retried.
1480 content (Any, optional): Network access instructions. Defaults to CONST.DEFAULT_MESSAGE_CONTENT.
1481 content_type (str, optional): Media type. Defaults to CONST.DEFAULT_MESSAGE_TYPE.
1482 headers (Mapping[str, str], optional): May include portal references. Defaults to None.
1485 Response: FastAPI Response object with status 511.
1487 return self.send_message_on_status(status=511, content=content, content_type=content_type, headers=headers)
Response multi_status(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response upgrade_required(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response switch_proxy(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response multiple_choices(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response send_message_on_status(self, int status=200, Any content=CONST.DEFAULT_MESSAGE_CONTENT, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Any _check_header(self, Optional[Mapping[str, str]] header=None)
Response precondition_failed(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response request_header_fields_too_large(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response early_hints(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response gone(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response send_continue(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response uri_too_long(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response invalid_token(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response locked(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response too_early(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response processing(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response switching_protocols(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response temporary_redirect(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response request_timeout(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response unauthorized(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response moved_permanently(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response not_acceptable(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response payment_required(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response proxy_authentication_required(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response already_reported(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response non_authoritative_information(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response range_not_satisfiable(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response precondition_required(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response response_is_stale(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response conflict(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response unavailable_for_legal_reasons(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response failed_dependency(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response misdirected_request(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Any _process_data_content(self, Any data, str data_type)
Response expectation_failed(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response bad_request(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response unsupported_media_type(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response no_content(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response reset_content(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response created(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response im_used(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Union[Response, FileResponse, HTMLResponse, JSONResponse, PlainTextResponse, RedirectResponse, StreamingResponse, UJSONResponse, ORJSONResponse] _package_correctly(self, int status=200, Any content=CONST.DEFAULT_MESSAGE_CONTENT, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response too_many_requests(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response permanent_redirect(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response payload_too_large(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response enhance_your_calm(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response found(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response use_proxy(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response forbidden(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response unprocessable_entity(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response see_other(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response not_modified(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response success(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response partial_content(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
str _check_data_type(self, Optional[ContentTypeLike] data_type=None)
Response length_required(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response page_expired(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response accepted(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response im_a_teapot(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response not_found(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)
Response method_not_allowed(self, Any content=CONST.DEFAULT_MESSAGE_CONTENT, *, ContentTypeLike content_type=CONST.DEFAULT_MESSAGE_TYPE, Optional[Mapping[str, str]] headers=None)