summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Philipp15b/go-steam/netutil/http.go
blob: fdaa055a919a60c027acb0be2648614d45f04c29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package netutil

import (
	"net/http"
	"net/url"
	"strings"
)

// Version of http.Client.PostForm that returns a new request instead of executing it directly.
func NewPostForm(url string, data url.Values) *http.Request {
	req, err := http.NewRequest("POST", url, strings.NewReader(data.Encode()))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	return req
}