pub enum HttpApiResponse<T>{
Ok(Json<T>),
Created(Json<T>),
MovedPermanently(Json<RedirectResponse>),
Found(Json<RedirectResponse>),
BadRequest(Json<ErrorResponse>),
Unauthorized(Json<ErrorResponse>),
Forbidden(Json<ErrorResponse>),
NotFound(Json<ErrorResponse>),
TooManyRequest(Json<ErrorResponse>),
InternalServerError(Json<ErrorResponse>),
BadGateway(Json<ErrorResponse>),
ServiceUnavailable(Json<ErrorResponse>),
}Variants§
Ok(Json<T>)
Created(Json<T>)
MovedPermanently(Json<RedirectResponse>)
Found(Json<RedirectResponse>)
BadRequest(Json<ErrorResponse>)
Forbidden(Json<ErrorResponse>)
NotFound(Json<ErrorResponse>)
TooManyRequest(Json<ErrorResponse>)
InternalServerError(Json<ErrorResponse>)
BadGateway(Json<ErrorResponse>)
Trait Implementations§
Source§impl<T> ApiResponse for HttpApiResponse<T>
impl<T> ApiResponse for HttpApiResponse<T>
Source§const BAD_REQUEST_HANDLER: bool = false
const BAD_REQUEST_HANDLER: bool = false
If true, it means that the response object has a custom bad request
handler.
Source§fn register(registry: &mut Registry)
fn register(registry: &mut Registry)
Register the schema contained in this response object to the registry.
Source§fn from_parse_request_error(err: Error) -> Self
fn from_parse_request_error(err: Error) -> Self
Convert
poem::Error to this response object.Source§impl<T> From<HttpApiResponse<T>> for Error
impl<T> From<HttpApiResponse<T>> for Error
Source§fn from(resp: HttpApiResponse<T>) -> Error
fn from(resp: HttpApiResponse<T>) -> Error
Converts to this type from the input type.
Source§impl<T> IntoResponse for HttpApiResponse<T>
impl<T> IntoResponse for HttpApiResponse<T>
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Consume itself and return
Response.Source§fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
Wrap an
impl IntoResponse to add a header. Read moreSource§fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
Wrap an
impl IntoResponse to with a new content type. Read moreSource§fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
Wrap an
impl IntoResponse to set a status code. Read moreAuto Trait Implementations§
impl<T> Freeze for HttpApiResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for HttpApiResponse<T>where
T: RefUnwindSafe,
impl<T> Send for HttpApiResponse<T>
impl<T> Sync for HttpApiResponse<T>
impl<T> Unpin for HttpApiResponse<T>where
T: Unpin,
impl<T> UnwindSafe for HttpApiResponse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for Twhere
T: IntoResponse,
impl<T> IntoResult<T> for Twhere
T: IntoResponse,
Source§fn into_result(self) -> Result<T, Error>
fn into_result(self) -> Result<T, Error>
Consumes this value returns a
poem::Result<T>.