Added docs
This commit is contained in:
parent
5c2838600c
commit
d35580e71c
@ -8,13 +8,13 @@ pub struct TypedHttpResponse<B: Serialize> {
|
||||
pub response: HttpResponse<Option<web::Json<Result<B, Vec<MessageResource>>>>>,
|
||||
}
|
||||
impl<B: Serialize> TypedHttpResponse<B> {
|
||||
// Returns a response with the json struct inside + Status code
|
||||
/// Returns a response with the json struct inside + Status code
|
||||
pub fn return_standard_response(status_code: StatusCode, body: B) -> TypedHttpResponse<B>{
|
||||
TypedHttpResponse {
|
||||
response: HttpResponse::with_body(StatusCode::from_u16(u16::from(status_code)).unwrap(), Some(web::Json(Ok(body))))
|
||||
}
|
||||
}
|
||||
// Returns a response with the json error list inside + Status code
|
||||
/// Returns a response with the json error list inside + Status code
|
||||
pub fn return_standard_error_list(status_code: StatusCode, body: Vec<MessageResource>) -> TypedHttpResponse<B>{
|
||||
TypedHttpResponse {
|
||||
response: HttpResponse::with_body(StatusCode::from_u16(u16::from(status_code)).unwrap(), Some(web::Json(Err(body))))
|
||||
@ -25,7 +25,7 @@ impl<B: Serialize> TypedHttpResponse<B> {
|
||||
response: HttpResponse::with_body(StatusCode::from_u16(u16::from(status_code)).unwrap(), Some(web::Json(Err(vec![body]))))
|
||||
}
|
||||
}
|
||||
// Returns an empty response with status code
|
||||
/// Returns an empty response with status code
|
||||
pub fn return_empty_response(status_code: StatusCode) -> TypedHttpResponse<B>{
|
||||
TypedHttpResponse {
|
||||
response: HttpResponse::with_body(StatusCode::from_u16(u16::from(status_code)).unwrap(), None)
|
||||
|
Loading…
Reference in New Issue
Block a user