- From: Clifford Fajardo <notifications@github.com>
- Date: Sat, 27 Aug 2022 15:06:21 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 27 August 2022 22:06:33 UTC
I tried using `fetch` and `node-fetch` to make GET with a request body, but it fails with: ``` Request with GET/HEAD method cannot have body ``` This isn't surprising to me as I've run into it in the past; plus also read thread above. ### Workaround for Nodejs runtime (_not in browser ... JS on the server_) Unfortunately the API I'm working with I cannot change at this time so I needed a work around. You can use the [axios library](https://www.npmjs.com/package/axios) to make GET with request body. ```js // only works in node const res = await axios.get("/api/devices", { data: { deviceName: 'name' } }) ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/83#issuecomment-1229276590 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/83/1229276590@github.com>
Received on Saturday, 27 August 2022 22:06:33 UTC