Mis parámetros de URL son demasiado grandes. Así que estoy tratando de obtener ese contenido pasándolo en request.body . La API funciona bien con el cartero durante las pruebas. Pero no puedo buscarlo en React
Estoy usando ExpressJS
API: http://localhost:5000/api/v1
Código de reacción:
let result = await fetch("http://localhost:8080/autocomplete",{ method: 'GET', body: { "text": "something new" } }); console.log(await result.json()) // Not get my data hereERROR:
TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have a body.¿Cómo resuelvo este problema?
se espera
De los documentos de mozilla, se menciona: 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