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

307
Vistas
React JS - How to pass body request in GET of fetch?

My Url Params are too big. So I'm trying to get that content with passing it in request.body. The API works fine with postman while testing. But not able to fetch it in React

I'm using ExpressJS

API: http://localhost:5000/api/v1

React Code:


let result = await fetch("http://localhost:8080/autocomplete",{
            method: 'GET',
            body: {
                "text": "something new"
            } 
});

console.log(await result.json())   // Not get my data here

ERROR:

TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have a body.

How i solve this issue ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is expected.
From mozilla docs, it mentioned: The HTTP GET method requests a representation of the specified resource. Requests using GET should only be used to request data (they shouldn't include data).
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET

about 4 years ago · Juan Pablo Isaza Denunciar
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