res.set()

Sets specified response header (header) to the specified value (value).

Alternatively, you can pass in a single object argument (headers) to set multiple header fields at once, where the keys are the header field names, and the corresponding values are the desired values.

Usage

  1. res.set(header, value);

-or-

  1. res.set(headers);

Example

  1. res.set('Content-Type', 'text/plain');
  2. res.set({
  3. 'Content-Type': 'text/plain',
  4. 'Content-Length': '123',
  5. 'ETag': '12345'
  6. })