@@ -320,9 +320,10 @@ visit the registry's website to obtain a token, and Cargo can store the token
320320using the [ ` cargo login ` ] command, or by passing the token on the
321321command-line.
322322
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 use the 200 response code for success.
324+ Errors should use an appropriate response code, such as 404.
325+ Failure
326+ responses should have a JSON object with the following structure:
326327
327328``` javascript
328329{
@@ -336,10 +337,10 @@ responses have a JSON object with the following structure:
336337}
337338```
338339
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 .
340+ If the response has this structure Cargo will display the detailed message to the user, even if the response code is 200.
341+ If the response code indicates an error and the content does not have this structure, Cargo will display to the user a
342+ message intended to help debugging the server error. A server returning an ` errors ` object allows a registry to provide a more
343+ detailed or user-centric error message .
343344
344345For backwards compatibility, servers should ignore any unexpected query
345346parameters or JSON fields. If a JSON field is missing, it should be assumed to
0 commit comments