I have the following code:
```
b := bytes.NewBuffer([]byte(""))
go func() {
for _, v := range z {
jsonStr, err := json.Marshal(&v)
if err != nil {
continue
}
b.Write([]byte(string(jsonStr) + "\n"))
}
}()
fullUrl := fmt.Sprintf("%s/%s", baseUrl, "_bulk")
req, err := http.NewRequest("POST", fullUrl, b)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/json")
c := http.Client{}
resp, err := c.Do(req)
```
is this the correct way to stream the body to the request?
I put the same code here for ease of reading:
https://gist.github.com/ORESoftware/c76359206fc98659725f17491fb30cca
-alex
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/9d64d98f-2e7c-408d-99e3-84ee2fbba410n%40googlegroups.com.