mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
Import WSDL to collection (#5015)
* Import WSDL to bruno collection * feat(wsdl-import): remove unused code and minor refactor --------- Co-authored-by: Bijin Bruno <bijin@usebruno.com>
This commit is contained in:
@@ -54,4 +54,4 @@ server.on('upgrade', wsRouter);
|
||||
|
||||
server.listen(port, function () {
|
||||
console.log(`Testbench started on port: ${port}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,12 +8,12 @@ const wss = new ws.Server({
|
||||
noServer: true,
|
||||
handleProtocols: (protocols, request) => {
|
||||
if (request.url == '/ws/sub-proto') {
|
||||
if (protocols.has("soap")) {
|
||||
return 'soap'
|
||||
if (protocols.has('soap')) {
|
||||
return 'soap';
|
||||
}
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,20 +55,18 @@ const wsRouter = (request, socket, head) => {
|
||||
}
|
||||
|
||||
if (request.url == '/ws/sub-proto') {
|
||||
const subproto = request.headers["sec-websocket-protocol"] || request.headers["Sec-WebSocket-Protocol"]
|
||||
if (subproto != "soap") {
|
||||
const message = "Unsupported WebSocket subprotocol"
|
||||
socket.write(
|
||||
'HTTP/1.1 400 Bad Request\r\n' +
|
||||
'Content-Type: text/plain\r\n' +
|
||||
`Content-Length: ${Buffer.byteLength(message)}\r\n` +
|
||||
'Connection: close\r\n' +
|
||||
'\r\n' +
|
||||
message
|
||||
);
|
||||
const subproto = request.headers['sec-websocket-protocol'] || request.headers['Sec-WebSocket-Protocol'];
|
||||
if (subproto != 'soap') {
|
||||
const message = 'Unsupported WebSocket subprotocol';
|
||||
socket.write('HTTP/1.1 400 Bad Request\r\n'
|
||||
+ 'Content-Type: text/plain\r\n'
|
||||
+ `Content-Length: ${Buffer.byteLength(message)}\r\n`
|
||||
+ 'Connection: close\r\n'
|
||||
+ '\r\n'
|
||||
+ message);
|
||||
socket.destroy();
|
||||
socket.removeListener('error', onSocketError);
|
||||
return
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user