
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
response-spy
Advanced tools
Intercepts HTTP response headers && body (without any man-in-the-middle http proxy server)
_ __ ___ ___ _ __ ___ _ __ ___ ___ ___ _ __ _ _
| '__/ _ \/ __| '_ \ / _ \| '_ \/ __|/ _ \ / __| '_ \| | | |
| | | __/\__ \ |_) | (_) | | | \__ \ __/ \__ \ |_) | |_| |
|_| \___||___/ .__/ \___/|_| |_|___/\___| |___/ .__/ \__, |
| | | | __/ |
|_| |_| |___/
Node module for intercepting HTTP responses sent in your apps.
var http = require('http');
var intercept = require('response-spy');
http.createServer(function(req, res) {
// returns a readable stream with the response output as the data
var stream = intercept(res);
// You can also see the headers sent, uncomment below
/*
stream.on('headers', function(headers, statusCode) {
// headers === Array || null (implicit headers)
console.log('url: %s, headers: ', req.url, headers);
});
*/
stream.pipe(process.stdout);
if (req.url === '/') {
res.setHeader('X-Powered-By', 'alessioalex');
res.writeHead(200, { 'Content-Type': 'text/html', 'X-Pid': 1239 });
res.end('Hello world\n');
} else if (req.url === '/pipe') {
require('fs').createReadStream(__filename).pipe(res);
} else if (req.url === '/implicit-headers') {
res.end('go\n');
} else {
res.writeHead(404, { 'Connection': 'closed', 'Content-Type': 'text/html' });
res.end('Page Not Found\n');
}
}).listen(5000);
console.log('Ok good, now visit http://localhost:5000/ && http://localhost:5000/pipe');
console.log('.. and then check your terminal');
It overrides the OutgoingMessage
native functions (write
, writeHead
, end
, setHeader
, removeHeader
), without affecting your apps (the original functions will be called with the same params, these are just thin wrappers).
With response-spy
you practically get a ReadableStream
from your response
object.
FAQs
Intercepts HTTP response headers && body (without any man-in-the-middle http proxy server)
The npm package response-spy receives a total of 58 weekly downloads. As such, response-spy popularity was classified as not popular.
We found that response-spy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.