THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class MediaTypeRegistry(IMediaTypeRegistry): (source)
Constructor: MediaTypeRegistry(parsers)
Map lowercased media-type strings to synchronous BodyParser callables.
multipart/form-data is intentionally absent: multipart parsing requires a streaming body rather than pre-buffered bytes. Request.payload() handles that case explicitly before consulting this registry.
| Parameters | |
| parsers | Initial mapping of media types to parsers. Keys are lowercased automatically. Defaults to an empty mapping. |
| Method | __init__ |
Initialise the registry with an optional media-type mapping. |
| Method | extend |
Return a new registry that merges parsers over a copy of self. |
| Method | get |
Return the parser registered for media_type, or None. |
| Method | register |
Add or replace the parser for media_type in place. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _parsers |
Undocumented |
Initialise the registry with an optional media-type mapping.
| Parameters | |
parsers:dict[str, BodyParser] | None | Initial media-type-to-parser mapping. Keys are lowercased on ingestion. Pass None to start with an empty registry. |
| Returns | |
None | Undocumented |
Return a new registry that merges parsers over a copy of self.
The original registry is not mutated. Use this pattern for middleware or provider-level overrides.
| Parameters | |
parsers:dict[str, BodyParser] | Additional or replacement media-type-to-parser entries. |
| Returns | |
MediaTypeRegistry | New registry containing all entries from self plus parsers. |
Return the parser registered for media_type, or None.
| Parameters | |
mediastr | Case-insensitive media-type string. |
| Returns | |
BodyParser | None | The registered (bytes) -> object callable, or None when media_type has no registered parser. |
Add or replace the parser for media_type in place.
| Parameters | |
mediastr | Case-insensitive media-type string, e.g. "application/json". |
parser:BodyParser | Synchronous callable (bytes) -> object. |
| Returns | |
None | Undocumented |