Add Microsoft Todo migration (#737)
Add more logs Fix lint Generate docs Add swagger docs Add microsoft todo parsing logic go mod tidy Add basic test structure Add more fields to tasks rename microsoft todo package Add getting microsoft todo data Add structs and helper methods Add microsoft todo config and routes Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/737 Co-Authored-By: konrad <konrad@kola-entertainments.de> Co-Committed-By: konrad <konrad@kola-entertainments.de>
This commit is contained in:
@ -20,6 +20,8 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DownloadFile downloads a file and returns its contents
|
||||
@ -38,3 +40,15 @@ func DownloadFile(url string) (buf *bytes.Buffer, err error) {
|
||||
_, err = buf.ReadFrom(resp.Body)
|
||||
return
|
||||
}
|
||||
|
||||
// DoPost makes a form encoded post request
|
||||
func DoPost(url string, form url.Values) (resp *http.Response, err error) {
|
||||
req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, url, strings.NewReader(form.Encode()))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
hc := http.Client{}
|
||||
return hc.Do(req)
|
||||
}
|
||||
|
Reference in New Issue
Block a user