More > JRiver Media Center 32 for Windows
MCWS should 400 when given a bad request (and it should log something)
mattkhan:
currently, if you have a typo in a URL then MC responds with a 500 and there's no info in the logs to hint at what happened
it should a) respond with a 400 (so it's obvious the fault is behind the keyboard) and b) log something to say what happened
e.g.
MCWS/v1/Command/MCC?Command=22000 produces a 500 but Command/MCC is wrong so it should 400 instead
Matt:
I get a response with this when I try your command:
<Response Status="Failure" Information="Function 'Command/MCC' not found."/>
mattkhan:
Yes but the http status code is what I am referring to, it should not 500 at this point
Matt:
If we switch to responding with a 404 the error is no longer shown since the browser doesn't render the page. So I think the current approach is better.
mattkhan:
One might argue that 404 is technically more correct for a rest API but mcws isn't a rest API so that's not relevant before, it should return 400 not 404 in case because the request itself is bad
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
Warning: The client should not repeat this request without modification.
This warning is exactly correct
500 is
server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
There's nothing unexpected here so this error code is not appropriate
Navigation
[0] Message Index
[#] Next page
Go to full version