{"name":"responselike","version":"4.0.0","keywords":["http","https","response","mock","test","request","responselike"],"license":"MIT","_id":"responselike@4.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/responselike#readme","bugs":{"url":"https://github.com/sindresorhus/responselike/issues"},"xo":{"rules":{"@typescript-eslint/no-restricted-types":"off"}},"dist":{"shasum":"3d4bdac0b8f3acdec518ab6921a5cd56d01d1deb","tarball":"http://registry-npm.ywwl.com/responselike/download/responselike-4.0.0.tgz","fileCount":5,"integrity":"sha512-NHMPb+9A5tC/iZCWnFdBNc+m+2m7xZwFIEhbfwUBeyk1w5H+tzWOROZaZAEZj5BXgpEM3i8B57R+iBi1a3TBiw==","signatures":[{"sig":"MEUCIQCCHsGRnoSOfLLFGJFoGFg8Nu0+Vg2EMNqosg+pQz5cUgIgQ+c4rFxX6uBiO0v8FkD8Hd44e5WtyPq22yNNb1s1B6I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6077,"size":2484,"noattachment":false,"key":"/responselike/-/responselike-4.0.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"f2c7d78cc299c44de882d1bb4d33589ff0a75794","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/responselike.git","type":"git"},"_npmVersion":"11.6.1","description":"A response-like object for mocking a Node.js HTTP response stream","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"lowercase-keys":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.3","ava":"^6.4.1","tsd":"^0.33.0","get-stream":"^9.0.1","@types/node":"^24.7.1","decompress-response":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/responselike_4.0.0_1760068292966_0.2895819135778499","host":"s3://npm-registry-packages-npm-production"},"readme":"# responselike\n\n> A response-like object for mocking a Node.js HTTP response stream\n\nReturns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). Useful for formatting cached responses so they can be consumed by code expecting a real response.\n\n## Install\n\n```sh\nnpm install responselike\n```\n\n## Usage\n\n```js\nimport Response from 'responselike';\n\nconst response = new Response({\n\tstatusCode: 200,\n\theaders: {\n\t\tfoo: 'bar'\n\t},\n\tbody: Buffer.from('Hi!'),\n\turl: 'https://example.com'\n});\n\nresponse.statusCode;\n// 200\n\nresponse.headers;\n// {foo: 'bar'}\n\nresponse.body;\n// <Buffer 48 69 21>\n\nresponse.url;\n// 'https://example.com'\n\nresponse.pipe(process.stdout);\n// 'Hi!'\n```\n\n## API\n\n### new Response(options?)\n\nReturns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage).\n\n#### options\n\nType: `object`\n\n##### statusCode\n\nType: `number`\n\nThe HTTP response status code.\n\n##### headers\n\nType: `object`\n\nThe HTTP headers. Keys will be automatically lowercased.\n\n##### body\n\nType: `Buffer`\n\nThe response body. The Buffer contents will be streamable but is also exposed directly as `response.body`.\n\n##### url\n\nType: `string`\n\nThe request URL string.\n","publish_time":1760068293155,"_cnpm_publish_time":1760068293155,"dist-tags":{"latest":"4.0.2"}}