Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
// We define these manually to ensure they're always copied
|
||||
// even if they would move up the prototype chain
|
||||
// https://nodejs.org/api/http.html#http_class_http_incomingmessage
|
||||
const knownProps = [
|
||||
'destroy',
|
||||
'setTimeout',
|
||||
'socket',
|
||||
'headers',
|
||||
'trailers',
|
||||
'rawHeaders',
|
||||
'statusCode',
|
||||
'httpVersion',
|
||||
'httpVersionMinor',
|
||||
'httpVersionMajor',
|
||||
'rawTrailers',
|
||||
'statusMessage'
|
||||
];
|
||||
|
||||
module.exports = (fromStream, toStream) => {
|
||||
const fromProps = new Set(Object.keys(fromStream).concat(knownProps));
|
||||
|
||||
for (const prop of fromProps) {
|
||||
// Don't overwrite existing properties
|
||||
if (prop in toStream) {
|
||||
continue;
|
||||
}
|
||||
|
||||
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
|
||||
}
|
||||
};
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "mimic-response",
|
||||
"version": "1.0.1",
|
||||
"description": "Mimic a Node.js HTTP response stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/mimic-response",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"mimic",
|
||||
"response",
|
||||
"stream",
|
||||
"http",
|
||||
"https",
|
||||
"request",
|
||||
"get",
|
||||
"core"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"create-test-server": "^0.1.0",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz"
|
||||
,"_integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
|
||||
,"_from": "mimic-response@^1.0.1"
|
||||
}
|
||||
Reference in new issue
Block a user