Config for todo
This commit is contained in:
31
upload.go
Normal file
31
upload.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"local/oauth2"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Upload(config Config, transaction *Transaction) error {
|
||||
params := url.Values{
|
||||
"list": {"2548023766"},
|
||||
"title": {"test task: " + time.Now().String()},
|
||||
"tag": {"expense"},
|
||||
}
|
||||
req, err := http.NewRequest("POST", config.TodoAddr+"/ajax.php?newTask", strings.NewReader(params.Encode()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Cookie", oauth2.COOKIE+"="+config.TodoToken)
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("%+v\n\n%+v", req, resp)
|
||||
return errors.New("not impl")
|
||||
}
|
||||
Reference in New Issue
Block a user