@@ -4319,9 +4319,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
4319
4319
signPromise = this . http . requestOtherUrl < IThirdPartySigned > ( Method . Post , url ) ;
4320
4320
}
4321
4321
4322
- const queryString : Record < string , string | string [ ] > = { } ;
4322
+ let queryParams : QueryDict = { } ;
4323
4323
if ( opts . viaServers ) {
4324
- queryString [ "server_name" ] = opts . viaServers ;
4324
+ queryParams . server_name = opts . viaServers ;
4325
+ queryParams . via = opts . viaServers ;
4326
+ if ( this . canSupport . get ( Feature . MigrateServerNameToVia ) === ServerSupport . Unstable ) {
4327
+ queryParams = replaceParam ( "via" , "org.matrix.msc4156.via" , queryParams ) ;
4328
+ }
4325
4329
}
4326
4330
4327
4331
const data : IJoinRequestBody = { } ;
@@ -4331,7 +4335,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
4331
4335
}
4332
4336
4333
4337
const path = utils . encodeUri ( "/join/$roomid" , { $roomid : roomIdOrAlias } ) ;
4334
- const res = await this . http . authedRequest < { room_id : string } > ( Method . Post , path , queryString , data ) ;
4338
+ const res = await this . http . authedRequest < { room_id : string } > ( Method . Post , path , queryParams , data ) ;
4335
4339
4336
4340
const roomId = res . room_id ;
4337
4341
// In case we were originally given an alias, check the room cache again
@@ -4364,9 +4368,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
4364
4368
4365
4369
const path = utils . encodeUri ( "/knock/$roomIdOrAlias" , { $roomIdOrAlias : roomIdOrAlias } ) ;
4366
4370
4367
- const queryParams : Record < string , string | string [ ] > = { } ;
4371
+ let queryParams : QueryDict = { } ;
4368
4372
if ( opts . viaServers ) {
4369
4373
queryParams . server_name = opts . viaServers ;
4374
+ queryParams . via = opts . viaServers ;
4375
+ if ( this . canSupport . get ( Feature . MigrateServerNameToVia ) === ServerSupport . Unstable ) {
4376
+ queryParams = replaceParam ( "via" , "org.matrix.msc4156.via" , queryParams ) ;
4377
+ }
4370
4378
}
4371
4379
4372
4380
const body : Record < string , string > = { } ;
0 commit comments