Skip to content

Commit

Permalink
cfcli-55: Remove Content-Type header for download droplet
Browse files Browse the repository at this point in the history
  • Loading branch information
gururajsh committed Jun 20, 2024
1 parent 56666f0 commit f8a3d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/cloudcontroller/ccv3/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (requester *RealRequester) newHTTPRequest(passedRequest requestOptions) (*c
request.Header.Set("Accept", "application/json")
}

if request.Header.Get("Content-Type") == "" {
if passedRequest.RequestName != internal.GetDropletBitsRequest && request.Header.Get("Content-Type") == "" {
request.Header.Set("Content-Type", "application/json")
}

Expand Down
5 changes: 5 additions & 0 deletions api/cloudcontroller/ccv3/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"runtime"
"strings"

"code.cloudfoundry.org/cli/api/cloudcontroller"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
Expand Down Expand Up @@ -160,6 +161,10 @@ func (requester *RealRequester) MakeRequestSendReceiveRaw(
return nil, nil, err
}

if strings.Contains(URL, "droplet") && strings.Contains(URL, "download") {
request.Header.Del("Content-Type")
}

response := cloudcontroller.Response{}

err = requester.connection.Make(request, &response)
Expand Down

0 comments on commit f8a3d28

Please sign in to comment.