Created
June 13, 2018 12:39
-
-
Save NKjoep/0a9abaea7f56fc708965ba3099fe6670 to your computer and use it in GitHub Desktop.
Mock ExpressJS request object
This file contains hidden or 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
function emptyRequest() { | |
return { | |
_destroy: undefined, | |
_read: undefined, | |
accepted: [], | |
accepts: undefined, | |
acceptsCharsets: undefined, | |
acceptsEncodings: undefined, | |
acceptsLanguages: undefined, | |
addListener: undefined, | |
app: undefined, | |
baseUrl: '', | |
body: '', | |
clearCookie: undefined, | |
connection: undefined, | |
cookies: '', | |
destroy: undefined, | |
emit: undefined, | |
eventNames: undefined, | |
fresh: true, | |
get: (_name: string) => { return null; }, | |
getMaxListeners: undefined, | |
header: (_name: string) => { return null; }, | |
headers: {}, | |
host: '', | |
hostname: '', | |
httpVersion: '', | |
httpVersionMajor: 0, | |
httpVersionMinor: 0, | |
ip: '', | |
ips: [], | |
is: undefined, | |
isPaused: undefined, | |
listenerCount: undefined, | |
listeners: undefined, | |
method: '', | |
on: undefined, | |
once: undefined, | |
originalUrl: '', | |
param: undefined, | |
params: '', | |
path: '', | |
pause: undefined, | |
pipe: undefined, | |
prependListener: undefined, | |
prependOnceListener: undefined, | |
protocol: '', | |
push: undefined, | |
query: '', | |
range: undefined, | |
rawHeaders: [], | |
rawTrailers: [], | |
read: undefined, | |
readable: undefined, | |
readableHighWaterMark: undefined, | |
removeAllListeners: undefined, | |
removeListener: undefined, | |
resume: undefined, | |
route: undefined, | |
secure: false, | |
setEncoding: undefined, | |
setMaxListeners: undefined, | |
setTimeout: undefined, | |
signedCookies: undefined, | |
socket: undefined, | |
stale: false, | |
subdomains: [''], | |
trailers: {}, | |
unpipe: undefined, | |
unshift: undefined, | |
url: '', | |
wrap: undefined, | |
xhr: false, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment