Here's an example of how to make an HTTP OPTIONS request in Go:
main.go700 chars33 lines
In this example, we first create an http.NewRequest
object with the method set to "OPTIONS" and the URL set to the desired endpoint. We then use an http.Client
to send the request and obtain an http.Response
object. Finally, we can process the response as needed (in this case, simply printing out the status and headers).
gistlibby LogSnag