Skip to content

Commit

Permalink
Merge pull request #26 from ralfyang/agent
Browse files Browse the repository at this point in the history
update for httpDefaultClient
  • Loading branch information
ralfyang authored Jul 1, 2020
2 parents 35d11c3 + de895e3 commit 9c93cbb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions communicator/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ import (
var http_body_buffer string

func Put_http(url, data, api_key_string string) {
// data, err := os.Open("text.txt")
// println(uri,":",data)
req, err := http.NewRequest("PUT", url, strings.NewReader(string(data)))
if err != nil {
log.Printf("HTTP PUT Request error: ",err)
}
req.Header.Set("Content-Type", "text/plain")
req.Header.Add("nexcloud-auth-token",api_key_string)
req.Header.Add("cache-control", "no-cache")
client := &http.Client{}
res, err := client.Do(req)
if err != nil {
log.Println(err)
}
defer res.Body.Close()
// client := &http.Client{}
// res, err := client.Do(req)
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Println(err)
}
defer res.Body.Close()
}

func Get_http(uri, api_key_string string) string{
Expand Down

0 comments on commit 9c93cbb

Please sign in to comment.