Get the HTTP Method from a Request
·
209 words
·
1 minute read
When working with any form of http communication in Go you’re going to come across scenarios where you need to know a request’s method - whether it’s a GET
, POST
, etc.
If you’re writing an API with Go you’ll most likely have the incoming request in the form of a http.Request
object. This request has Method
property which allows you to get the http method in the form of a string. Optionally, we can also use some constants to make working with these methods easier.
|
|