1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Improve body parsing

This commit is contained in:
2020-05-23 09:54:13 +02:00
parent 7c18f19674
commit 4b12de6e50
2 changed files with 26 additions and 6 deletions

View File

@ -51,6 +51,11 @@ impl HttpRequestHandler {
self.response.is_some()
}
/// Get the response status code, eg. 200 or 404
pub fn response_status_code(&self) -> u16 {
self.response.as_ref().unwrap().status().as_u16()
}
/// Take the response from this struct
pub fn response(self) -> HttpResponse {
self.response.unwrap()
@ -71,6 +76,10 @@ impl HttpRequestHandler {
Err(Box::try_from(actix_web::error::ErrorInternalServerError(error)).unwrap())
}
/// Get the path of the request
pub fn request_path(&self) -> String {
self.request.path().to_string()
}
/// Check login tokens
pub fn check_client_token(&mut self) -> ResultExecError<()> {