|
6 | 6 | Request as LightweightRequest,
|
7 | 7 | toRequestError,
|
8 | 8 | } from './request'
|
9 |
| -import { cacheKey, getInternalBody, Response as LightweightResponse } from './response' |
| 9 | +import { cacheKey, Response as LightweightResponse } from './response' |
10 | 10 | import type { InternalCache } from './response'
|
11 | 11 | import type { CustomErrorHandler, FetchCallback, HttpBindings } from './types'
|
12 | 12 | import { writeFromReadableStream, buildOutgoingHttpHeaders } from './utils'
|
@@ -93,28 +93,6 @@ const responseViaResponseObject = async (
|
93 | 93 |
|
94 | 94 | const resHeaderRecord: OutgoingHttpHeaders = buildOutgoingHttpHeaders(res.headers)
|
95 | 95 |
|
96 |
| - const internalBody = getInternalBody(res as Response) |
97 |
| - if (internalBody) { |
98 |
| - const { length, source, stream } = internalBody |
99 |
| - if (source instanceof Uint8Array && source.byteLength !== length) { |
100 |
| - // maybe `source` is detached, so we should send via res.body |
101 |
| - } else { |
102 |
| - // send via internal raw data |
103 |
| - if (length) { |
104 |
| - resHeaderRecord['content-length'] = length |
105 |
| - } |
106 |
| - outgoing.writeHead(res.status, resHeaderRecord) |
107 |
| - if (typeof source === 'string' || source instanceof Uint8Array) { |
108 |
| - outgoing.end(source) |
109 |
| - } else if (source instanceof Blob) { |
110 |
| - outgoing.end(new Uint8Array(await source.arrayBuffer())) |
111 |
| - } else { |
112 |
| - await writeFromReadableStream(stream, outgoing) |
113 |
| - } |
114 |
| - return |
115 |
| - } |
116 |
| - } |
117 |
| - |
118 | 96 | if (res.body) {
|
119 | 97 | /**
|
120 | 98 | * If content-encoding is set, we assume that the response should be not decoded.
|
|
0 commit comments