Skip to content

Commit

Permalink
feat(MockClient): Allow specifying URL
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Apr 28, 2021
1 parent d7ce060 commit 9119f42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/MockClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class MockClient extends MockPeer {
constructor(
private wsServer: WSServer,
private headers: { readonly [key: string]: string } = {},
private url: string = '/',
) {
super();

Expand All @@ -27,6 +28,9 @@ export class MockClient extends MockPeer {
...incomingMessage.headers,
...this.headers,
};
// tslint:disable-next-line:no-object-mutation
incomingMessage.url = this.url;

return new Promise((resolve) => {
this.wsServer.once('connection', resolve);
this.wsServer.emit('connection', this.peerWebSocket, incomingMessage);
Expand Down

0 comments on commit 9119f42

Please sign in to comment.