Created
January 9, 2017 17:01
-
-
Save lholden/1580eceebb98ef4dbcd8a4e5e2647632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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