Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

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

Open
lewis-geek opened this issue Apr 8, 2022 · 0 comments

Comments

@lewis-geek
Copy link

Describe the bug
Env: desktop browser

An error occurred when I used Http.request method, error message: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.

My request options:

{
    "url": "/api",
    "method": "GET",
    "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
    },
}

As you can see, I didn't add body property to the request options object.

I found that the buildRequestInit function which is used in the request function appended the body: "" property to the request options object, is this cause the issue?

Expected behavior
Request succeeded without error.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 100
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant