Fetch: TypeError: HEAD or GET Request cannot have a body.

Created on 29 Sep 2016  路  3Comments  路  Source: github/fetch

should HEAD or GET can not add a body ?

Most helpful comment

@jeffhuys Surely there should be an override for this? We don't always control the APIs we talk to, especially if they are written by another company. It seems extremely patronising to actively prevent people doing this.

All 3 comments

HEAD or GET requests should never have a body. Be sure you give body: undefined. null is not the same as "nothing".

@jeffhuys Surely there should be an override for this? We don't always control the APIs we talk to, especially if they are written by another company. It seems extremely patronising to actively prevent people doing this.

Stating that a GET request should never have a body is not in the HTTP spec. https://tools.ietf.org/html/rfc7231#section-4.3.1

Elasticache is the primary example of an api that uses bodies in GET requests.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

indranildutta06 picture indranildutta06  路  3Comments

shirotech picture shirotech  路  3Comments

codeashian picture codeashian  路  3Comments

kocur4d picture kocur4d  路  3Comments

knowbody picture knowbody  路  5Comments