MCPcopy Index your code
hub / github.com/nodejs/node / cloneRequest

Function cloneRequest

deps/undici/src/lib/web/fetch/request.js:961–975  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

959
960// https://fetch.spec.whatwg.org/#concept-request-clone
961function cloneRequest (request) {
962 // To clone a request request, run these steps:
963
964 // 1. Let newRequest be a copy of request, except for its body.
965 const newRequest = makeRequest({ ...request, body: null })
966
967 // 2. If request’s body is non-null, set newRequest’s body to the
968 // result of cloning request’s body.
969 if (request.body != null) {
970 newRequest.body = cloneBody(request.body)
971 }
972
973 // 3. Return newRequest.
974 return newRequest
975}
976
977/**
978 * @see https://fetch.spec.whatwg.org/#request-create

Callers 2

httpNetworkOrCacheFetchFunction · 0.70
cloneMethod · 0.70

Calls 2

makeRequestFunction · 0.70
cloneBodyFunction · 0.70

Tested by

no test coverage detected