Trait poem_openapi::ApiResponse
source · [−]pub trait ApiResponse: Sized {
const BAD_REQUEST_HANDLER: bool;
fn meta() -> MetaResponses;
fn register(registry: &mut Registry);
fn from_parse_request_error(err: Error) -> Self { ... }
}
Expand description
Represents a OpenAPI responses object.
Provided Implementations
-
Binary<T: Type>
A binary response with content type
application/octet-stream
. -
Json<T: Type>
A JSON response with content type
application/json
. -
PlainText<T: Type>
A utf8 string response with content type
text/plain
. -
Attachment<T: Type>
A file download response, the content type is
application/octet-stream
. -
Response<T: Type>
A response type use it to modify the status code and HTTP headers.
-
()
It means that this API does not have any response body.
-
poem::Result<T: ApiResponse>
It means that an error may occur in this API.
-
Any type derived from the
ApiResponse
macroA complex response derived from the
ApiResponse
macro.
Associated Constants
const BAD_REQUEST_HANDLER: bool
const BAD_REQUEST_HANDLER: bool
If true, it means that the response object has a custom bad request handler.
Required methods
Provided methods
fn from_parse_request_error(err: Error) -> Self
fn from_parse_request_error(err: Error) -> Self
Convert poem::Error
to this response object.