[whatwg/fetch] How to send ‘OPTIONS * HTTP/1.1’ requests (asterisk form) with fetch()? (Issue #1622)

From [RFC 9110, HTTP Semantics][1]:

> An OPTIONS request with an asterisk ("\*") as the request target (Section 7.1) applies to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 conformance (or lack thereof).

I wrote an HTTP server in JavaScript running on Node and would like to write a unit test for checking how it responds to the following request:

```
OPTIONS * HTTP/1.1
```

**How to send that request (asterisk form) with the [`fetch()`][2] JavaScript API?**

I know that it is possible with Curl using the [`--request-target`][3] option (the question was asked [here][4] on Stack Overflow):

```bash
curl --request-target '*' -X OPTIONS https://example.com/
```

If it’s not currently possible (like people seem to suggest on [Stack Overflow](https://stackoverflow.com/a/75835604/2326961)), then interpret this issue as a feature request.

  [1]: https://www.rfc-editor.org/rfc/rfc9110#section-9.3.7-2
  [2]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
  [3]: https://curl.se/docs/manpage.html#--request-target
  [4]: https://stackoverflow.com/q/36925133/2326961

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1622
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1622@github.com>

Received on Friday, 24 March 2023 17:12:24 UTC