wip/authorization-header #7
1 changed files with 7 additions and 1 deletions
|
@ -13,5 +13,11 @@ pub fn get_auth_header(headers: &HeaderMap) -> Result<&str, HttpResponse> {
|
||||||
return Err(HttpResponse::Unauthorized().json(format!(r#" {{ "error": "{}" }} "#, error)));
|
return Err(HttpResponse::Unauthorized().json(format!(r#" {{ "error": "{}" }} "#, error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(auth.unwrap())
|
let auth_value = auth.unwrap().split_whitespace().nth(1);
|
||||||
|
|
||||||
|
if let None = auth_value {
|
||||||
|
return Err(HttpResponse::BadRequest().finish());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(auth_value.unwrap())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue