I\'m using the http
package from Go to deal with POST request. How can I access and parse the content of the query string from the Request
object ? I can
Below words come from the official document.
Form contains the parsed form data, including both the URL field's query parameters and the POST or PUT form data. This field is only available after ParseForm is called.
So, sample codes as below would work.
func parseRequest(req *http.Request) error {
var err error
if err = req.ParseForm(); err != nil {
log.Error("Error parsing form: %s", err)
return err
}
_ = req.Form.Get("xxx")
return nil
}