Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GO - net/http - how to get request string and method

Tags:

go

Using the net/http i want a way to get the current request string and the method i.e. GET, POST, PUT etc.

Is this possible - i cant see it in the docs

like image 217
Marty Wallace Avatar asked Jul 29 '13 22:07

Marty Wallace


1 Answers

You can use the following fields of the Request struct:

Method string

and

RequestURI string

I suggest you to look at the source code of the struct: Request struct source code

You can access it by clicking on the struct name in the go doc for the net/http package.

like image 142
Andrea Di Persio Avatar answered Oct 08 '22 15:10

Andrea Di Persio