2

In a node-soap server, how do I change the HTTP headers of a node-soap server response?

In a client request, I can add extra HTTP headers like so

client.addHttpHeader('User-Agent', `CustomUserAgent`);

However, what I need is to change the HTTP headers of a response. How can I do that? A way to access the http.ServerResponse object would allow me to use setHeader and would probably work for me as well.

7hibault
  • 2,371
  • 3
  • 23
  • 33
  • Use express and write a middleware module for it. – Quentin Jun 06 '18 at 15:26
  • @Quentin Could you please elaborate? Are you suggesting that I should use express as a base server for node-soap instead of the built-in HTTP server, and then write an express middleware to change the HTTP headers of the response? – 7hibault Jun 06 '18 at 16:14
  • to see an example of what @Quentin did suggest, take a look at https://github.com/vpulim/node-soap#soaplistenserver-path-services-wsdl---create-a-new-soap-server-that-listens-on-path-and-provides-services – herom Jun 12 '18 at 14:05

0 Answers0