()
| 341 | } |
| 342 | |
| 343 | private unreadable(): HttpClientError.HttpClientError | undefined { |
| 344 | const type = this.headers["content-type"] |
| 345 | if (!this.binary && type !== undefined && binaryType.test(type)) { |
| 346 | return this.decodeError( |
| 347 | `A ${type} body can't be read as text: set NativeHttpClient.ResponseType to "binary"` |
| 348 | ) |
| 349 | } |
| 350 | if (this.streamed) { |
| 351 | return this.decodeError("The body was already read as a stream") |
| 352 | } |
| 353 | const error = this.exchange.error |
| 354 | if (error) return this.failed(error) |
| 355 | } |
| 356 | |
| 357 | private bytes(chunk: string): Uint8Array | HttpClientError.HttpClientError { |
| 358 | if (!this.binary) return (encoder ??= new TextEncoder()).encode(chunk) |
no test coverage detected