Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created December 17, 2013 20:48
Show Gist options
  • Save sintaxi/8012367 to your computer and use it in GitHub Desktop.
Save sintaxi/8012367 to your computer and use it in GitHub Desktop.
superagent not returning a body when status code is 500. running node v0.10.17.
var http = require('http')
var assert = require('assert')
var agent = require('superagent')
http.createServer(function (req, res) {
res.writeHead(500, {'Content-Type': 'text/plain'})
res.end('Hello World\n')
}).listen(1337, '127.0.0.1', function(){
agent.get('http://127.0.0.1:1337/').end(function(err, response){
assert.equal(response.status, 500)
assert.equal(response.body, 'Hello World\n')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment