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() JavaScript API?
From RFC 9110, HTTP Semantics:
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:
How to send that request (asterisk form) with the
fetch()
JavaScript API?I know that it is possible with Curl using the
--request-target
option (the question was asked on Stack Overflow):If it’s not currently possible (like people seem to suggest on Stack Overflow), then interpret this issue as a feature request.