How can you set HTTP headers in the response object when using the http module?

  • response.headers = {...}
  • response.setHeader(name, value)
  • response.setHeaders({...})
  • response.addHeader(name, value)
To set HTTP headers in the response object when using the http module, you should use response.setHeader(name, value). This method allows you to set individual headers with their corresponding values. The other options are not valid methods for setting headers.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *