fix: consistent use of client var
This commit is contained in:
parent
15736f91d9
commit
db25867e57
4
main.go
4
main.go
@ -96,10 +96,12 @@ Note: Use "" around everything but numbers, also wrap json in ''
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
data := args[0]
|
data := args[0]
|
||||||
res, err := http.Post(resource, "application/json; charset=UTF-8", bytes.NewBufferString(data))
|
req, err := http.NewRequest(http.MethodPost, resource, bytes.NewBufferString(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
req.Header.Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
|
res, err := client.Do(req)
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
body, err := ioutil.ReadAll(res.Body)
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user