Ok, I know it's a bad idea and it shouldn't be done but for the sake of this question please assume there's no other way - I am given API endpoint that requires GET request with empty object as a body.
Is there a way to do async request from browser?
I'm using axios
library which uses XMLHttpRequest
under the hood and MDN says that send
wipes the body when HTTP method is GET
.
I tried using native fetch
but it gives me this error in browser:
TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.
Is there any way to do it?