1
0
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:
Quentin Gliech
2023-02-23 17:18:26 +01:00
parent 97635375cc
commit 67753c0e26
2 changed files with 354 additions and 0 deletions

View File

@@ -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()
}