Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

beefs up and extends node's http.ServerResponse object

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 example
Octocat-spinner-32 lib
Octocat-spinner-32 MIT.lic
Octocat-spinner-32 ReadMe.md
Octocat-spinner-32 addHeadUsage.js
Octocat-spinner-32 package.json
ReadMe.md

response - beefs up and extends node's http.ServerResponse object

Installation

npm install response

Usage

require('response');

Now http.ServerResponse is monkey patched with additional methods.

ServerResponse.setHeader Example

var http     = require('http');

require('response');

http.createServer(function (req, res) {
  var content = 'hello, i know nodejitsu.';

  res.setHeader('Content-Length', content.length);
  res.setHeader('Foo-Bar', 'A');
  res.setHeader('Foo-Tar', 'B');

  res.writeHead(200, {
    'Content-Type': 'text/plain',
    'Foo-Tar': 'C'
  });

  res.write(content);
  res.end();
}).listen(8080);

Response Headers

Content-Type    text/plain
Foo-Tar C
Content-Length  21
Foo-Bar A
Connection  keep-alive

Authors

Alexis Sellier (cloudhead), Marak Squires

Something went wrong with that request. Please try again.