Skip to content

Commit ad2b7b1

Browse files
committed
servers should use 404
1 parent 92ff479 commit ad2b7b1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/doc/src/reference/registries.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,8 @@ visit the registry's website to obtain a token, and Cargo can store the token
320320
using the [`cargo login`] command, or by passing the token on the
321321
command-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 should use the 200 or 404 response code as appropriate. Failure
324+
responses should have a JSON object with the following structure:
326325

327326
```javascript
328327
{
@@ -336,10 +335,11 @@ responses have a JSON object with the following structure:
336335
}
337336
```
338337

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).
343343

344344
For backwards compatibility, servers should ignore any unexpected query
345345
parameters or JSON fields. If a JSON field is missing, it should be assumed to

0 commit comments

Comments
 (0)