nmos-testing icon indicating copy to clipboard operation
nmos-testing copied to clipboard

Test cases for POST etc. should fail 3xx responses

Open garethsb opened this issue 3 years ago • 3 comments

Per IS-04 docs, URLs: Approach to Trailing Slashes, POST requests MUST be issued by Clients without a trailing slash and Servers implementing the APIs MUST correctly interpret such requests. Although the wording could be clearer as always, I believe this means Servers MUST NOT respond with a 3xx redirection.

I wonder if IS-04-02 test_30 would originally have caught this issue for the Registration API /health endpoint, but doesn't any longer because do_request was updated to allow redirects? The same issue may be affecting other API test cases for POST, DELETE, PATCH, etc. I remember we checked and updated all such test cases to use the endpoints without a trailing slash.

garethsb avatar Sep 03 '21 07:09 garethsb

https://docs.python-requests.org/en/master/user/quickstart/#redirection-and-history says that we'd need to explicitly pass allow_redirects to get the behaviour we need.

garethsb avatar Sep 03 '21 09:09 garethsb

@jonathan-r-thorpe, this would be another appropriate test on clients as well, that they don't send POST, PATCH, DELETE, etc. with a trailing slash on any API.

garethsb avatar Sep 03 '21 09:09 garethsb

AFAIK the Flask endpoints on the current implementation of the mock Registry and mock Node will reject trailing slashes with a 404 error, so should be covered already.

jonathan-r-thorpe avatar Sep 08 '21 08:09 jonathan-r-thorpe