Skip to content

Instantly share code, notes, and snippets.

@lholden
Created January 9, 2017 17:01
Show Gist options
  • Save lholden/1580eceebb98ef4dbcd8a4e5e2647632 to your computer and use it in GitHub Desktop.
Save lholden/1580eceebb98ef4dbcd8a4e5e2647632 to your computer and use it in GitHub Desktop.
#[get("/", format="application/json")]
fn list() -> &'static str {
"{}"
}
#[get("/", rank=2)]
fn index() -> &'static str {
"second"
}
/*
$ curl -X GET -H "Content-Type: application/json" http://localhost:5000/organization
{}
$ curl -X GET http://localhost:5000/organization
{}
*/
// ------
#[get("/", format="application/json")]
fn list() -> &'static str {
"{}"
}
#[get("/")]
fn index() -> &'static str {
"second"
}
/*
Collision... always gets the second route even for application/json
$ curl -X GET -H "Content-Type: application/json" http://localhost:5000/organization
second
*/
// ------
#[get("/", format="application/json")]
fn list() -> &'static str {
"{}"
}
#[get("/", format="text/html")]
fn index() -> &'static str {
"second"
}
/*
$ curl -X GET -H "Content-Type: application/json" http://localhost:5000/organization
{}
curl -X GET http://localhost:5000/organization
second
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment