mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-11 03:32:01 -08:00
18 lines
413 B
Go
18 lines
413 B
Go
|
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
|
||
|
}
|