Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
React, Fetch sending empty body

So I have a problem about sending a request. Body is not empty at all since I can log it. But somehow when I make a request, the body is empty. It was weird so I copied a working request code that didn't send an empty body, guess what? Body empty. I have cors enabled.

empty body === second

image

  const handleSubmit = async (e) => {
    e.preventDefault()
    try {
      let data = new FormData()
      data.set("key", "")
      data.append("image", groupPFP.file)

      const res = await fetch("https://api.imgbb.com/1/upload", {
        method: "POST",
        body: data,
      })

      const parseRes = await res.json()

      if (parseRes.status === 200) {
        const imgbbLink = parseRes.data.display_url

        const resData = { groupProfileImage: imgbbLink, groupName, groupAbout }

        const res = await fetch("http://localhost:5000/api/group/create", {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            JwtToken: localStorage.getItem("JwtToken"),
          },
          body: JSON.stringify(resData),
        })

        const parseResPFP = await res.json()

        if (parseResPFP.status === 429) {
          return toast.error("Too Many Requests, try again later")
        }

        toast.success("Group created successfully")
      }
    } catch (error) {
      console.error(error)
    }
  }

No errors

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda