| 1154 | } |
| 1155 | |
| 1156 | const fromWebBody = (request: globalThis.Request, method: string): HttpBody.HttpBody => { |
| 1157 | if (!hasBody(method) || request.body === null) { |
| 1158 | return HttpBody.empty |
| 1159 | } |
| 1160 | return HttpBody.raw(request.body, { |
| 1161 | contentType: request.headers.get("content-type") ?? undefined, |
| 1162 | contentLength: bodyInternal.parseContentLength(request.headers.get("content-length")) |
| 1163 | }) |
| 1164 | } |
| 1165 | |
| 1166 | /** |
| 1167 | * Converts an `HttpClientRequest` safely to a Web `Request` as a `Result`, failing when the request URL is invalid. |