(
hasRequestBody: boolean,
method: (
path: string,
bodyOrOpts?: any,
opts?: ClientVerbOptions,
) => Promise<ClientResponse<any>>,
)
| 66 | const callClient = new Client({ urlPrefix: this.url, auth: false }); |
| 67 | type verbFn = (...args: any) => Promise<string>; |
| 68 | const verbFactory = ( |
| 69 | hasRequestBody: boolean, |
| 70 | method: ( |
| 71 | path: string, |
| 72 | bodyOrOpts?: any, |
| 73 | opts?: ClientVerbOptions, |
| 74 | ) => Promise<ClientResponse<any>>, |
| 75 | ): verbFn => { |
| 76 | return async (pathOrOptions?: string | HttpsOptions, options?: HttpsOptions) => { |
| 77 | const { path, opts } = this.extractArgs(pathOrOptions, options); |
| 78 | try { |
| 79 | const res = hasRequestBody |
| 80 | ? await method(path, opts.body, toClientVerbOptions(opts)) |
| 81 | : await method(path, toClientVerbOptions(opts)); |
| 82 | this.requestCallBack(undefined, res, res.body); |
| 83 | } catch (err) { |
| 84 | this.requestCallBack(err); |
| 85 | } |
| 86 | return HTTPS_SENTINEL; |
| 87 | }; |
| 88 | }; |
| 89 | |
| 90 | const shim = verbFactory(true, (path: string, json?: any, opts?: ClientVerbOptions) => { |
| 91 | const req = Object.assign(opts || {}, { |
nothing calls this directly
no test coverage detected