eslint-plugin-unicorn icon indicating copy to clipboard operation
eslint-plugin-unicorn copied to clipboard

Add `no-invalid-fetch-options` rule

Open fisker opened this issue 1 year ago • 3 comments

Fixes #1989

fisker avatar May 08 '24 09:05 fisker

Should add OPTIONS, TRACE and CONNECT:

Request has body: No

silverwind avatar May 08 '24 10:05 silverwind

These doesn't thows

fetch('/', {method: 'OPTIONS', body: 'foo'})
fetch('/', {method: 'TRACE', body: 'foo'})
fetch('/', {method: 'CONNECT', body: 'foo'})

The spec only forbids GET and HEAD.

fisker avatar May 08 '24 10:05 fisker

These doesn't thows

fetch('/', {method: 'OPTIONS', body: 'foo'})
fetch('/', {method: 'TRACE', body: 'foo'})
fetch('/', {method: 'CONNECT', body: 'foo'})

The spec only forbids GET and HEAD.

Ok, then MDN is just inaccurate.

silverwind avatar May 08 '24 10:05 silverwind

Thanks @fisker!

GauBen avatar May 10 '24 06:05 GauBen