Utilumo
LightDarkSystem

Updated August 26, 2026

cURL and fetch request parts reference

cURL and fetch both describe an HTTP request. This sheet maps the pieces that most converters can preserve without executing the request.

Request part mapping

Request partcURLfetch()Conversion note
URLcurl 'https://api.example.com/users'fetch("https://api.example.com/users")Use an absolute URL for copyable examples.
Method-X PATCHmethod: "PATCH"cURL data flags imply POST when no method is set.
Header-H 'Content-Type: application/json'headers: { "Content-Type": "application/json" }Header names are case-insensitive.
JSON body--data-raw '{"name":"Ada"}'body: JSON.stringify({ name: "Ada" })Only stringify valid JSON-like request bodies.
Compression--compressedbrowser-managedBrowsers handle response compression automatically.
fetch is not terminal cURLfetch runs under browser security rules. CORS, credentials, redirects, mixed content, and forbidden headers can change what a converted request is allowed to do.

References

Questions

Does fetch automatically decompress responses?

In browsers, response compression is handled by the browser networking layer. You do not add a fetch option equivalent to cURL's --compressed.

Can fetch set every cURL header?

No. Browsers restrict some headers for security, and CORS can block access to the response.