Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour of api for crate names #283

Closed
caulagi opened this issue Mar 8, 2016 · 4 comments
Closed

Behaviour of api for crate names #283

caulagi opened this issue Mar 8, 2016 · 4 comments

Comments

@caulagi
Copy link

caulagi commented Mar 8, 2016

Is the treatment of crate names (particularly underscores and hyphens) something that can be relied on?

$ curl -I -H "Content-Type: application/json" -H "Accept: application/json" https://crates.io/api/v1/crates/error-def
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx
$
$ curl -I -H "Content-Type: application/json" -H "Accept: application/json" https://crates.io/api/v1/crates/error_def
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx
$
$ curl -I -H "Content-Type: application/json" -H "Accept: application/json" https://crates.io/api/v1/crates/errror_def
HTTP/1.1 404 Not Found
Connection: keep-alive
Server: nginx

So in this case, error_def is the correct crate name, but asking for error-def also gives a 200. Is this documented or am I missing something?

@alexcrichton
Copy link
Member

Yeah this is currently intentional because it helps with some renames we've done in the past. The JSON returned should have the full name of the crate, however.

@killercup
Copy link
Member

@alexcrichton, do you plan on supporting this "forever"? I.e., can cargo-edit rely on this behaviour to cleverly outsource crate name normalisation?

@alexcrichton
Copy link
Member

Yeah I suspect this won't change

@killercup
Copy link
Member

Cool. We'll be using that in cargo-add, then :)

Am 08.03.2016 um 22:26 schrieb Alex Crichton notifications@github.com:

Yeah I suspect this won't change


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants