{"name":"responselike","version":"3.0.0","description":"A response-like object for mocking a Node.js HTTP response stream","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/responselike.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Luke Childs","email":"lukechilds123@gmail.com","url":"https://lukechilds.co.uk"},"type":"module","exports":"./index.js","engines":{"node":">=14.16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["http","https","response","mock","test","request","responselike"],"dependencies":{"lowercase-keys":"^3.0.0"},"devDependencies":{"ava":"^4.3.1","get-stream":"^6.0.1","tsd":"^0.22.0","xo":"^0.50.0"},"types":"./index.d.ts","gitHead":"2ec61fa6535fe2a793ad32016b1f1b95d16d5e06","bugs":{"url":"https://github.com/sindresorhus/responselike/issues"},"homepage":"https://github.com/sindresorhus/responselike#readme","_id":"responselike@3.0.0","_nodeVersion":"14.19.3","_npmVersion":"8.3.2","dist":{"integrity":"sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==","shasum":"20decb6c298aff0dbee1c355ca95461d42823626","tarball":"http://registry-npm.ywwl.com/responselike/download/responselike-3.0.0.tgz","fileCount":5,"unpackedSize":5554,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxNJRKTcmeSe83f3aRc9xxYAzi6/TaCiWKNZTcGuMHcgIgfaXZaLlXKzxuC5mjA8RI8D10mWvfLVaCOyMLDtXlks8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi1cszACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqsA//fEwtDenRzXIywsEemvT0TSMNBuBH9TsvK5LXumUbtjMUDVfJ\r\n4XMEGqPfrh5DdpVMk2V7t61qOqvk6YJIIRx7OSJZDeeFlOdDlBmdRXen7Uy6\r\nh+EjN7ikoIMBN0wgxPIYYojX9ffQWHH785zL0Jvrm3tFjyNCdpKJvvhzFJR8\r\nsx6edWB2boAWb4X8YDXxHUNWIlbGaq3fY6ewg+TQ0cqES5UF6NYLtT81Q7O5\r\nVNEFYAAQBpFGYxt8k8csBolTMQkO8VAq/pYhobXdcigNN/1ImWcdzVTddE3f\r\nGHUoSCxwRV+xOe6T1avBktsPCaNyh0cEUqH0ax6GVRsq3XJjvoWueQXy6O2L\r\nof7UWfKPyU2s838oE/y3lg+uM0MHx1rZWNEXDZEVvoZEkttk6+awd3hPF3bJ\r\nItfaFu66KyxPjHpUSWSNqpFbwC//mpftcHZf++//G6NpSnuaw39o/bKzTEST\r\nisiPZrrqG/eCJ8ome6Zb1i2JubLWNoKfgBlZfsv8C33mJvQOsF7kf28lyHES\r\n6LAemKTXo8cyhYC5Hgy7dJQ5UoSCweHRGLRJvKBNZfawYr2Tc2E4Y2W7c18o\r\nPpr3usuZcLnb6C2jynx3TR6X0367zzRKqRPhGrfu7rHvZzrc1o0Gz0m+8Eoi\r\nk3Nra1Qvb8+kZHUaBroryaITxG9QftYqPFk=\r\n=NyHG\r\n-----END PGP SIGNATURE-----\r\n","size":2209,"noattachment":false,"key":"/responselike/-/responselike-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"lukechilds","email":"lukechilds123@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/responselike_3.0.0_1658178355629_0.3164521105754696"},"_hasShrinkwrap":false,"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":1658178355896,"_cnpm_publish_time":1658178355896,"dist-tags":{"latest":"4.0.2"}}