MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / stubServerRequest

Function stubServerRequest

packages/testlab/src/shot.ts:33–43  ·  view source on GitHub ↗
(
  options: ShotRequestOptions,
)

Source from the content-addressed store, hash-verified

31type ShotRequestCtor = new (options: ShotRequestOptions) => IncomingMessage;
32
33export function stubServerRequest(
34 options: ShotRequestOptions,
35): IncomingMessage {
36 const stub = new ShotRequest(options);
37 // Hacky workaround for Express, see
38 // https://github.com/expressjs/express/blob/4.16.3/lib/middleware/init.js
39 // https://github.com/hapijs/shot/issues/82#issuecomment-247943773
40 // https://github.com/jfhbrook/pickleback
41 Object.assign(stub, ShotRequest.prototype);
42 return stub;
43}
44
45const ShotResponse: ShotResponseCtor = require('@hapi/shot/lib/response');
46export type ShotCallback = (response: ResponseObject) => void;

Callers 1

stubHandlerContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected