Promise based HTTP client for the browser and node.js.

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
axios("https://httpbin.org/ip")
  .then((res) => console.log(res.data))
  .catch((err) => console.warn(err))
async function getIP() {
  try {
    const res = await axios("https://httpbin.org/ip")
    console.log(res.data)
  } catch (err) {
    console.warn(err)
  }
}
axios.post("/user", { firstName: "Fred", lastName: "Flintstone" })
const { data } = await axios.post("/user", document.querySelector("#my-form"), {
  headers: {
    "Content-Type": "application/json",
  },
})
const { data } = await axios.post(
  "https://httpbin.org/post",
  {
    firstName: "Fred",
    lastName: "Flintstone",
    orders: [1, 2, 3],
    photo: document.querySelector("#fileInput").files,
  },
  {
    headers: {
      "Content-Type": "multipart/form-data",
    },
  },
)
const { data } = await axios.post(
  "https://httpbin.org/post",
  {
    firstName: "Fred",
    lastName: "Flintstone",
    orders: [1, 2, 3],
  },
  {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  },
)

Thanks