SponsorBlockServer/test/mocks/mockExpressRequest.ts
2022-09-24 22:51:20 -04:00

33 lines
662 B
TypeScript

const nullStub = (): any => null;
export const createRequest = (options: any) => ({
app: {},
baseUrl: "",
body: {},
cookies: {},
fresh: true,
headers: {},
hostname: "example.com",
ip: "",
ips: [],
method: "GET",
originalUrl: "/",
params: {},
path: "/",
protocol: "https",
query: {},
route: {},
secure: true,
signedCookies: {},
stale: false,
subdomains: [],
xhr: true,
accepts: nullStub(),
acceptsCharsets: nullStub(),
acceptsEncodings: nullStub(),
acceptsLanguages: nullStub(),
get: nullStub(),
is: nullStub(),
range: nullStub(),
...options
});