π 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'});