You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and got my document when acceptin app/json or / with curl. But I got a 404 when accepting text/html.
I wanted to get 406 - Not accepted ( simplifies debugging my clients, I know failure is in the accept header ), so I built an H406 route which just does "throw halt(406)" and added
get("/mypath",H406)
AFTER the previous. As the documentation states routes are processed in order I expected it to match anything not catched.
Testing I got 406 for text/html and 200+doc for app/json, but for the default '*/*' used by curl for accept I got the 406 too. I was expecting for it to match the first route,
Then I went into jedi mode and used the source, and found a route without acceptType gets registered as */*, and the mime parser matches it as preferrable to the first one because it matches exactly with what the client sends.
I'm not familiar enough with spark to assert it is a bug, but I consider this as either a code bug or a documentation one, as I suspect many people will interpret the docs as I did.
( Not a big problem as it can be easily patched or coded around, and not sure of my source analysis being a spark novice. )
The text was updated successfully, but these errors were encountered:
I did a test with .
get("/mypath","application/json", MyRoute)
and got my document when acceptin app/json or / with curl. But I got a 404 when accepting text/html.
I wanted to get 406 - Not accepted ( simplifies debugging my clients, I know failure is in the accept header ), so I built an H406 route which just does "throw halt(406)" and added
get("/mypath",H406)
AFTER the previous. As the documentation states routes are processed in order I expected it to match anything not catched.
Testing I got 406 for text/html and 200+doc for app/json, but for the default '
*/*
' used by curl for accept I got the 406 too. I was expecting for it to match the first route,Then I went into jedi mode and used the source, and found a route without acceptType gets registered as
*/*
, and the mime parser matches it as preferrable to the first one because it matches exactly with what the client sends.I'm not familiar enough with spark to assert it is a bug, but I consider this as either a code bug or a documentation one, as I suspect many people will interpret the docs as I did.
( Not a big problem as it can be easily patched or coded around, and not sure of my source analysis being a spark novice. )
The text was updated successfully, but these errors were encountered: