Skip to content
OddsockLocal
Local
Source text

Formatting

1 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Enter an absolute http or https URL, with no userinfo.
  2. Choose the request method.
  3. Add headers as one Name: value line each. Put the body in the body field.
  4. Copy the Axios snippet. The request is not sent.

What is Axios snippet?

Axios generator fills in a URL, a method, optional headers and an optional body, then prints an import and an axios() call. A POST to https://example.test/api with Content-Type: application/json and the body {"name":"Sam"} becomes an axios config whose data field is the JSON text, not a parsed object. The snippet logs response.data.

Read more

The page does not perform the request. There is no network call to example.test, which matters when the URL is a production host and the body is a real payload you are only trying to document. Header names are lowercased in the output, so Content-Type is written content-type. Repeated header names are rejected.

The URL has to be absolute http or https, with no username or password embedded. Snippet format is fixed to axios on this page. The HTTP request builder is the one that can emit curl, fetch, Python, Go or PHP from the same fields.

Use cases

  • A frontend developer copies a working Axios call into a ticket instead of describing the headers in prose.
  • Someone reproducing a bug wants the exact data string Axios will send, including the JSON quotes.
  • A reviewer checks that a password is not sitting in the URL before the snippet is shared.
  • You already know you want Axios and do not want to pick the format from a longer list.

POST JSON to a test host

URL https://example.test/api, method POST, header Content-Type: application/json, body {"name":"Sam"}.

import axios from "axios"; then axios({ url, method: "POST", headers: { "content-type": "application/json" }, data: "{\"name\":\"Sam\"}" }) and console.log(response.data).

Why use Oddsock

The data field stays a string, so you can see the bytes you asked to send instead of an object Axios might reshape later.

Related tools

Using this tool

No. It only prints code. example.test is never contacted, which is what you want when the URL is real and you are still drafting.