Skip to content

Commit

Permalink
Merge aa899a2 into d1c8632
Browse files Browse the repository at this point in the history
  • Loading branch information
chimurai committed Aug 13, 2021
2 parents d1c8632 + aa899a2 commit 7165969
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"supertest": "^6.1.5",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5",
"ws": "^7.4.6"
"ws": "^8.1.0"
},
"dependencies": {
"@types/http-proxy": "^1.17.5",
Expand Down
15 changes: 10 additions & 5 deletions test/e2e/websocket.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ describe('E2E WebSocket proxy', () => {
wss = new WebSocketServer({ port: WS_SERVER_PORT });

wss.on('connection', (websocket) => {
websocket.on('message', (message) => {
websocket.on('message', (data, isBinary) => {
const message = isBinary ? data : data.toString();
websocket.send(message); // echo received message
});
});
Expand Down Expand Up @@ -66,7 +67,8 @@ describe('E2E WebSocket proxy', () => {
});

it('should proxy to path', (done) => {
ws.on('message', (message) => {
ws.on('message', (data, isBinary) => {
const message = isBinary ? data : data.toString();
expect(message).toBe('foobar');
done();
});
Expand All @@ -84,7 +86,8 @@ describe('E2E WebSocket proxy', () => {
});

it('should proxy to path', (done) => {
ws.on('message', (message) => {
ws.on('message', (data, isBinary) => {
const message = isBinary ? data : data.toString();
expect(message).toBe('foobar');
done();
});
Expand All @@ -109,7 +112,8 @@ describe('E2E WebSocket proxy', () => {
});

it('should proxy to path', (done) => {
ws.on('message', (message) => {
ws.on('message', (data, isBinary) => {
const message = isBinary ? data : data.toString();
expect(message).toBe('foobar');
done();
});
Expand All @@ -136,7 +140,8 @@ describe('E2E WebSocket proxy', () => {
});

it('should proxy to path', (done) => {
ws.on('message', (message) => {
ws.on('message', (data, isBinary) => {
const message = isBinary ? data : data.toString();
expect(message).toBe('foobar');
done();
});
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5870,6 +5870,11 @@ ws@^7.3.1, ws@^7.4.5, ws@^7.4.6, ws@~7.4.2:
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==

ws@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.1.0.tgz#75e5ec608f66d3d3934ec6dbc4ebc8a34a68638c"
integrity sha512-0UWlCD2s3RSclw8FN+D0zDTUyMO+1kHwJQQJzkgUh16S8d3NYON0AKCEQPffE0ez4JyRFu76QDA9KR5bOG/7jw==

xml-name-validator@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
Expand Down

0 comments on commit 7165969

Please sign in to comment.