Fix defaultResponseHeaders setter #137

Merged
merged 1 commit into from May 6, 2012

Conversation

Projects
None yet
2 participants
Contributor

hmarr commented May 5, 2012

defaultResponseHeaders wasn't being overwritten, as the new function was being assigned to defaultHeaders by the setter. The following example demonstrates the behaviour:

var restify = require('./lib/index');

server = restify.createServer();

var message = "Error! defaultResponseHeaders was not overridden.";
restify.defaultResponseHeaders = function() {
  message = "Success! defaultResponseHeaders was overridden.";
}

server.listen(9912);

client = restify.createClient({url: 'http://127.0.0.1:9912', type: 'json'});
client.get('/', function (err, req, res, obj) {
  server.close();
  console.log(message);
});
Contributor

mcavage commented May 6, 2012

Doh. Thanks!

mcavage added a commit that referenced this pull request May 6, 2012

@mcavage mcavage merged commit c6152ab into restify:master May 6, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment