( options: ShotRequestOptions, )
| 31 | type ShotRequestCtor = new (options: ShotRequestOptions) => IncomingMessage; |
| 32 | |
| 33 | export 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 | |
| 45 | const ShotResponse: ShotResponseCtor = require('@hapi/shot/lib/response'); |
| 46 | export type ShotCallback = (response: ResponseObject) => void; |
no outgoing calls
no test coverage detected