Here is an example of how to create an HTTP server in C# using the HttpListener class with an OPTIONS route:
main.cs1107 chars36 lines
This server listens on http://localhost:8080/
and responds with "Hello, World!" for all HTTP methods except for OPTIONS. When an OPTIONS request is received, it appends an Allow
header with a list of allowed HTTP methods and responds with a 200 OK status code.
gistlibby LogSnag