๐ Disallow invalid options in fetch() and new Request().
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
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: 'HEAD'});// โ
const request = new Request('/', {method: 'HEAD'});// โ
const response = await fetch('/', {method: 'GET', body: 'foo=bar'});
// โ
const response = await fetch('/', {method: 'POST', body: 'foo=bar'});// โ
const request = new Request('/', {method: 'GET', body: 'foo=bar'});
// โ
const request = new Request('/', {method: 'POST', body: 'foo=bar'});