MCPcopy
hub / github.com/apify/crawlee / intoImpitBody

Method intoImpitBody

packages/impit-client/src/index.ts:88–99  ·  view source on GitHub ↗
(
        body?: Exclude<HttpRequest<TResponseType>['body'], undefined>,
    )

Source from the content-addressed store, hash-verified

86 }
87
88 private intoImpitBody<TResponseType extends keyof ResponseTypes>(
89 body?: Exclude<HttpRequest<TResponseType>['body'], undefined>,
90 ): RequestInit['body'] {
91 if (isGeneratorObject(body)) {
92 return Readable.toWeb(Readable.from(body)) as any;
93 }
94 if (body instanceof Readable) {
95 return Readable.toWeb(body) as any;
96 }
97
98 return body as any;
99 }
100
101 private shouldRewriteRedirectToGet(httpStatus: number, method: HttpRequest<any>['method']): boolean {
102 // See https://github.com/mozilla-firefox/firefox/blob/911b3eec6c5e58a9a49e23aa105e49aa76e00f9c/netwerk/protocol/http/HttpBaseChannel.cpp#L4801

Callers 1

getResponseMethod · 0.95

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected