💼 This rule is enabled in the ✅ recommended
config.
fetch()
throws a TypeError
when the method is GET
or HEAD
and a body is provided.
const response = await fetch('/', {body: 'foo=bar'});
const request = new Request('/', {body: 'foo=bar'});
const response = await fetch('/', {method: 'GET', body: 'foo=bar'});
const request = new Request('/', {method: 'GET', body: 'foo=bar'});
const response = await fetch('/', {method: 'HEAD'});
const request = new Request('/', {method: 'HEAD'});
const response = await fetch('/', {method: 'POST', body: 'foo=bar'});
const request = new Request('/', {method: 'POST', body: 'foo=bar'});