@@ -320,9 +320,8 @@ visit the registry's website to obtain a token, and Cargo can store the token
320
320
using the [ ` cargo login ` ] command, or by passing the token on the
321
321
command-line.
322
322
323
- Responses use a 200 response code for both success and errors. Cargo looks at
324
- the JSON response to determine if there was success or failure. Failure
325
- responses have a JSON object with the following structure:
323
+ Responses should use the 200 or 404 response code as appropriate. Failure
324
+ responses should have a JSON object with the following structure:
326
325
327
326
``` javascript
328
327
{
@@ -336,10 +335,11 @@ responses have a JSON object with the following structure:
336
335
}
337
336
```
338
337
339
- Servers may also respond with a 404 response code to indicate the requested
340
- resource is not found (for example, an unknown crate name). However, using a
341
- 200 response with an ` errors ` object allows a registry to provide a more
342
- detailed error message if desired.
338
+ If the response has this structure Cargo will display the detailed message to the user, even if the response code is 200.
339
+ If the response code indicates an error and the content does not have this structure, Cargo will display to the user a
340
+ message intended to help debugging the server error. A server returning an ` errors ` object allows a registry to provide a more
341
+ detailed or user centric error message. The first release of Cargo to support registries Cargo 1.34 (released 2019-04-11) will only
342
+ show a human readable error if the code is 200, this has been fixed in all versions since Cargo 1.35 (released 2019-05-23).
343
343
344
344
For backwards compatibility, servers should ignore any unexpected query
345
345
parameters or JSON fields. If a JSON field is missing, it should be assumed to
0 commit comments