mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Improve body parsing
This commit is contained in:
@ -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<()> {
|
||||
|
Reference in New Issue
Block a user