File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,9 @@ impl Registry {
389
389
self . handle . url ( & format ! ( "{}/api/v1{}" , self . host, path) ) ?;
390
390
let mut headers = List :: new ( ) ;
391
391
headers. append ( "Accept: application/json" ) ?;
392
- headers. append ( "Content-Type: application/json" ) ?;
392
+ if body. is_some ( ) {
393
+ headers. append ( "Content-Type: application/json" ) ?;
394
+ }
393
395
394
396
if self . auth_required || authorized == Auth :: Authorized {
395
397
headers. append ( & format ! ( "Authorization: {}" , self . token( ) ?) ) ?;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ be required in the future.
40
40
41
41
Cargo sets the following headers for all requests:
42
42
43
- - ` Content-Type ` : ` application/json `
43
+ - ` Content-Type ` : ` application/json ` (for requests with a body payload)
44
44
- ` Accept ` : ` application/json `
45
45
- ` User-Agent ` : The Cargo version such as `cargo 1.32.0 (8610973aa
46
46
2019-01-02)`. This may be modified by the user in a configuration value.
You can’t perform that action at this time.
0 commit comments