From 47dcede5420cf4d43ec71a457020e38375591620 Mon Sep 17 00:00:00 2001 From: Levi Nunnink Date: Thu, 8 Aug 2019 14:46:37 -0700 Subject: [PATCH] Fixes bug where methodName would not be included in the response event (#1087) --- src/server.ts | 2 ++ test/server-test.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/server.ts b/src/server.ts index 1479a81f1..6b3e0141e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -372,6 +372,8 @@ export class Server extends EventEmitter { this.emit('headers', headers, pair.methodName); } + methodName = pair.methodName; + this._executeMethod({ serviceName: serviceName, portName: portName, diff --git a/test/server-test.js b/test/server-test.js index 67225dab6..10edb098c 100644 --- a/test/server-test.js +++ b/test/server-test.js @@ -379,6 +379,17 @@ describe('SOAP Server', function() { }); }); + it('should emit \'response\' event', function(done) { + test.soapServer.on('response', function requestManager(request, methodName) { + assert.equal(methodName, 'GetLastTradePrice'); + done(); + }); + soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) { + assert.ifError(err); + client.GetLastTradePrice({ tickerSymbol: 'AAPL'}, function() {}); + }); + }); + it('should emit \'headers\' event', function(done) { test.soapServer.on('headers', function headersManager(headers, methodName) { assert.equal(methodName, 'GetLastTradePrice');