Skip to content

Commit

Permalink
Generic Packages fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Wies <evan@neomantra.net>
  • Loading branch information
neomantra committed Nov 10, 2021
1 parent 8a42f19 commit d1303f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions generic_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ func (s *GenericPackagesService) PublishPackageFile(pid interface{}, packageName
pathEscape(fileName),
)

// This is currently the only way to use a PUT request to upload a non-JSON file
// This is currently the only way to use a PUT request to upload a non-JSON file.
// We invoke NewRequest with MethodGet so the body is not marshalled to JSON;
// WithUploadFile modifies the request to MethodPut
options = append(options, WithUploadFile(content))

req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return "", nil, nil, err
}
Expand Down

0 comments on commit d1303f6

Please sign in to comment.