You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
handlers: add tests for introspection endpoint
This commit is contained in:
@@ -325,6 +325,10 @@ pub(crate) trait RequestBuilderExt {
|
||||
/// Sets the request Authorization header to the given bearer token.
|
||||
fn bearer(self, token: &str) -> Self;
|
||||
|
||||
/// Sets the request Authorization header to the given basic auth
|
||||
/// credentials.
|
||||
fn basic_auth(self, username: &str, password: &str) -> Self;
|
||||
|
||||
/// Builds the request with an empty body.
|
||||
fn empty(self) -> hyper::Request<String>;
|
||||
}
|
||||
@@ -354,6 +358,13 @@ impl RequestBuilderExt for hyper::http::request::Builder {
|
||||
self
|
||||
}
|
||||
|
||||
fn basic_auth(mut self, username: &str, password: &str) -> Self {
|
||||
self.headers_mut()
|
||||
.unwrap()
|
||||
.typed_insert(Authorization::basic(username, password));
|
||||
self
|
||||
}
|
||||
|
||||
fn empty(self) -> hyper::Request<String> {
|
||||
self.body(String::new()).unwrap()
|
||||
}
|
||||
|
Reference in New Issue
Block a user