MCPcopy Create free account
hub / github.com/Effect-TS/effect / unreadable

Method unreadable

packages/ui/native/src/NativeHttpClient.ts:343–355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers 2

doneMethod · 0.95
streamMethod · 0.95

Calls 2

decodeErrorMethod · 0.95
failedMethod · 0.95

Tested by

no test coverage detected