@@ -1231,7 +1231,7 @@ impl MatrixMockServer {
1231
1231
& self ,
1232
1232
) -> MockEndpoint < ' _ , AuthenticatedMediaConfigEndpoint > {
1233
1233
let mock = Mock :: given ( method ( "GET" ) ) . and ( path ( "/_matrix/client/v1/media/config" ) ) ;
1234
- self . mock_endpoint ( mock, AuthenticatedMediaConfigEndpoint ) . expect_default_access_token ( )
1234
+ self . mock_endpoint ( mock, AuthenticatedMediaConfigEndpoint )
1235
1235
}
1236
1236
1237
1237
/// Create a prebuilt mock for the endpoint used to get the media config of
@@ -1559,6 +1559,15 @@ impl<'a, T> MockEndpoint<'a, T> {
1559
1559
self
1560
1560
}
1561
1561
1562
+ /// Don't expect authentication with an access token on this endpoint.
1563
+ ///
1564
+ /// This should be used to override the default behavior of the endpoint,
1565
+ /// when the access token is unknown for example.
1566
+ pub fn do_not_expect_access_token ( mut self ) -> Self {
1567
+ self . expected_access_token = ExpectedAccessToken :: None ;
1568
+ self
1569
+ }
1570
+
1562
1571
/// Specify how to respond to a query (viz., like
1563
1572
/// [`MockBuilder::respond_with`] does), when other predefined responses
1564
1573
/// aren't sufficient.
@@ -3763,13 +3772,6 @@ impl<'a> MockEndpoint<'a, MediaDownloadEndpoint> {
3763
3772
self . respond_with ( ResponseTemplate :: new ( 200 ) . set_body_string ( "Hello, World!" ) )
3764
3773
}
3765
3774
3766
- /// Returns a successful response with the given bytes.
3767
- pub fn ok_bytes ( self , bytes : Vec < u8 > ) -> MatrixMock < ' a > {
3768
- self . respond_with (
3769
- ResponseTemplate :: new ( 200 ) . set_body_raw ( bytes, "application/octet-stream" ) ,
3770
- )
3771
- }
3772
-
3773
3775
/// Returns a successful response with a fake image content.
3774
3776
pub fn ok_image ( self ) -> MatrixMock < ' a > {
3775
3777
self . respond_with (
@@ -3799,6 +3801,13 @@ impl<'a> MockEndpoint<'a, AuthedMediaDownloadEndpoint> {
3799
3801
self . respond_with ( ResponseTemplate :: new ( 200 ) . set_body_string ( "Hello, World!" ) )
3800
3802
}
3801
3803
3804
+ /// Returns a successful response with the given bytes.
3805
+ pub fn ok_bytes ( self , bytes : Vec < u8 > ) -> MatrixMock < ' a > {
3806
+ self . respond_with (
3807
+ ResponseTemplate :: new ( 200 ) . set_body_raw ( bytes, "application/octet-stream" ) ,
3808
+ )
3809
+ }
3810
+
3802
3811
/// Returns a successful response with a fake image content.
3803
3812
pub fn ok_image ( self ) -> MatrixMock < ' a > {
3804
3813
self . respond_with (
0 commit comments