Skip to content

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

Open
@geryogam

Description

@geryogam

From RFC 9110, HTTP Semantics:

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?

I know that it is possible with Curl using the --request-target option (the question was asked on Stack Overflow):

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

If it’s not currently possible (like people seem to suggest on Stack Overflow), then interpret this issue as a feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions