(descriptor: RequestDescriptor, requestOptions?: RequestOptions)
| 178 | } |
| 179 | |
| 180 | const request = async <A>(descriptor: RequestDescriptor, requestOptions?: RequestOptions): Promise<A> => { |
| 181 | const response = await execute(descriptor, requestOptions) |
| 182 | if (response.status !== descriptor.successStatus) return responseError(response, descriptor) |
| 183 | if (descriptor.empty) { |
| 184 | try { |
| 185 | await response.body?.cancel() |
| 186 | } catch {} |
| 187 | return undefined as A |
| 188 | } |
| 189 | return (await json(response)) as A |
| 190 | } |
| 191 | |
| 192 | const sse = <A>(descriptor: RequestDescriptor, requestOptions?: RequestOptions): AsyncIterable<A> => ({ |
| 193 | async *[Symbol.asyncIterator]() { |
no test coverage detected