From b9f75dd54ffc7459c22df6c3584b08dca31ef1ab Mon Sep 17 00:00:00 2001 From: arzumify Date: Mon, 28 Oct 2024 09:56:45 +0000 Subject: [PATCH] Added setting content-type similar to net/http in Post --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f8c82c9..ba46aa8 100644 --- a/main.go +++ b/main.go @@ -656,11 +656,12 @@ func Get(url string) (response *Response, err error) { return } -func Post(url string, body io.Reader) (response *Response, err error) { +func Post(url string, contentType string, body io.Reader) (response *Response, err error) { request, err := NewRequest("POST", url, body) if err != nil { return } + request.Header.Add("Content-Type", contentType) response, err = Fetch.Do(request) return }