diff --git a/doc/ws.md b/doc/ws.md index 0b1ba7a37..2c49c766f 100644 --- a/doc/ws.md +++ b/doc/ws.md @@ -326,17 +326,17 @@ Create a new WebSocket instance. #### UNIX Domain Sockets `ws` supports making requests to UNIX domain sockets. To make one, use the -following URL scheme: +following URL form: ``` -ws+unix:///absolute/path/to/uds_socket:/pathname?search_params +ws+unix:/absolute/path/to/uds_socket:/pathname?search_params ``` Note that `:` is the separator between the socket path and the URL path. If the URL path is omitted ``` -ws+unix:///absolute/path/to/uds_socket +ws+unix:/absolute/path/to/uds_socket ``` it defaults to `/`. diff --git a/test/websocket.test.js b/test/websocket.test.js index f5fbf1650..cf4cf10f2 100644 --- a/test/websocket.test.js +++ b/test/websocket.test.js @@ -1548,7 +1548,7 @@ describe('WebSocket', () => { server.once('upgrade', (req, socket) => { socket.end( - `HTTP/1.1 302 Found\r\nLocation: ws+unix://${socketPath}\r\n\r\n` + `HTTP/1.1 302 Found\r\nLocation: ws+unix:${socketPath}\r\n\r\n` ); }); @@ -1589,7 +1589,7 @@ describe('WebSocket', () => { ws.on('close', (code) => { assert.strictEqual(code, 1005); - assert.strictEqual(ws.url, `ws+unix://${socketPath}`); + assert.strictEqual(ws.url, `ws+unix:${socketPath}`); assert.strictEqual(ws._redirects, 1); redirectedServer.close(done); @@ -1616,7 +1616,7 @@ describe('WebSocket', () => { redirectingServer.on('upgrade', (req, socket) => { socket.end( 'HTTP/1.1 302 Found\r\n' + - `Location: ws+unix://${redirectedServerSocketPath}\r\n\r\n` + `Location: ws+unix:${redirectedServerSocketPath}\r\n\r\n` ); }); @@ -1645,10 +1645,10 @@ describe('WebSocket', () => { host: 'foo' }; - const ws = new WebSocket( - `ws+unix://${redirectingServerSocketPath}`, - { followRedirects: true, headers } - ); + const ws = new WebSocket(`ws+unix:${redirectingServerSocketPath}`, { + followRedirects: true, + headers + }); const firstRequest = ws._req; @@ -1666,7 +1666,7 @@ describe('WebSocket', () => { assert.strictEqual(code, 1005); assert.strictEqual( ws.url, - `ws+unix://${redirectedServerSocketPath}` + `ws+unix:${redirectedServerSocketPath}` ); assert.strictEqual(ws._redirects, 1); @@ -1723,7 +1723,7 @@ describe('WebSocket', () => { host: 'foo' }; - const ws = new WebSocket(`ws+unix://${socketPath}`, { + const ws = new WebSocket(`ws+unix:${socketPath}`, { followRedirects: true, headers });