Skip to content

Commit

Permalink
Use streaming while uploading to harness
Browse files Browse the repository at this point in the history
  • Loading branch information
rutvijmehta-harness committed Aug 12, 2024
1 parent b36d557 commit 05767ca
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions storage/backend/harness/harness.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package harness

import (
"bytes"
"context"
"encoding/xml"
"fmt"
Expand Down Expand Up @@ -107,17 +106,18 @@ type Content struct {
}

func (b *Backend) do(ctx context.Context, method, url string, body io.Reader) (*http.Response, error) {
var (
buffer []byte
err error
)
if body != nil {
buffer, err = io.ReadAll(body)
if err != nil {
return nil, err
}
}
req, err := http.NewRequestWithContext(ctx, method, url, bytes.NewReader(buffer))
//var (
// buffer []byte
// err error
//)
//if body != nil {
// buffer, err = io.ReadAll(body)
// if err != nil {
// return nil, err
// }
//}

req, err := http.NewRequestWithContext(ctx, method, url, body)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 05767ca

Please sign in to comment.