-
-
Save ipiyer/526f16bf03f1b6763550 to your computer and use it in GitHub Desktop.
terminate http stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require("request"); | |
exports.foo = function(req, res) { | |
request.get("foo.com") | |
.on('response', function(){ | |
if (response.statusCode === 404) { | |
// terminate and return {"error": "not found"} | |
// How do i do this? | |
} | |
}) | |
.pipe(res); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment