~ / labs/curl → fetch

curl → fetch.

paste a curl command — get a fetch() call (and axios) ready to drop into your js. handles flags: -X, -H, -d, -u, -L, --json, and more.

── parsed
methodPOST
urlhttps://bsky.social/xrpc/com.atproto.server.createSession
headers1
body52 bytes
── fetch
await fetch("https://bsky.social/xrpc/com.atproto.server.createSession", {
  method: "POST",
  headers: {
      "Content-Type": "application/json"
    },
  body: "{\"identifier\":\"handle.bsky.social\",\"password\":\"...\"}",
});
── axios
await axios({
  url: "https://bsky.social/xrpc/com.atproto.server.createSession",
  method: "post",
  headers: {
      "Content-Type": "application/json"
    },
  data: "{\"identifier\":\"handle.bsky.social\",\"password\":\"...\"}",
});
── fetch + read body
const res = await fetch("https://bsky.social/xrpc/com.atproto.server.createSession", {
  method: "POST",
  headers: {
      "Content-Type": "application/json"
    },
  body: "{\"identifier\":\"handle.bsky.social\",\"password\":\"...\"}",
});
const text = await res.text();
console.log(res.status, text);