Change error code from 405 to 400 for invalid props to @fields/@attrs
"John P. Rouillard" <[email protected]> Tue, 07 Dec 2021 01:23:13 -0500
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all:
I was working through some tickets on validating property names. I
noticed that the rest interface does throw an error for an invalid
property in @fields. However it is mapped to a 405 (wrong method)
rather than a 400 (bad request). I have made changes to generate
better error messages for:
@fields=bad
@fields=good.bad
which return a 400 error. So we see:
{
"error": {
"status": 400,
"msg": "'Unknown property: status.nam'"
}
}
and
{
"error": {
"status": 400,
"msg": "'Unknown property: status.nam'"
}
}
respectively.
This change is confined to rest.py::transitive_props() and is used for
@attr as well.
Since this changes the return code I wonder if I can push it without
bumping the rest version. I figure there are very few users but...
Also a filter like:
issu3?status.nam=o
returns a 403 forbidden error (User does not have search permission on
"issue.status.nam") not a 400 bad request. I think this needs fixing
too. (This can be handled by adding a call to transitive_props().)
Thoughts?
--
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.