Loading tool...
Loading tool...
Convert cURL commands to JavaScript fetch() calls
fetch()async function main() {
const response = await fetch("https://api.example.com/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer my-token-123",
},
body: `{"name": "Alice", "email": "alice@example.com"}`,
});
const data = await response.json();
console.log(data);
}
main();Example inputs