Function
handleCode
(res: IResponse<T>, resolve: (value: IResponse<R> | PromiseLike<IResponse<R>>) => void)
Source from the content-addressed store, hash-verified
| 31 | } |
| 32 | |
| 33 | function handleCode<T, R>(res: IResponse<T>, resolve: (value: IResponse<R> | PromiseLike<IResponse<R>>) => void) { |
| 34 | if (res.code) { |
| 35 | resolve({ |
| 36 | success: false, |
| 37 | code: res.code, |
| 38 | message: res.message, |
| 39 | }); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | export default function request<T>(url: string, options?: RequestInit): Promise<IResponse<T>> { |
| 44 | options = options || { |
Tested by
no test coverage detected