complement icon indicating copy to clipboard operation
complement copied to clipboard

Content-Type check is too restrictive in "TestRegistration/parallel/POST_{}_returns_a_set_of_flows"

Open MTRNord opened this issue 2 years ago • 1 comments

https://github.com/matrix-org/complement/blob/ad263aa5d0dfbd823d99e486642d71f402a07ffa/tests/csapi/apidoc_register_test.go#L50-L52

In "TestRegistration/parallel/POST_{}_returns_a_set_of_flows" the test strictly required application/json. It's common for many servers to return also a charset in the content type, which is valid according to HTTP. However, complement considers this as a failure which I discovered while testing https://github.com/MTRNord/persephone :)

❌ TestRegistration/parallel/POST_{}_returns_a_set_of_flows (0s) apidoc_register_test.go:48: MatchResponse got Content-Type: application/json; charset=utf-8 want application/json - http://127.0.0.1:32819/_matrix/client/v3/register => {"flows":[{"stages":["m.login.dummy"]}],"session":"Kbxte1cyWasGZdeIeBsf9FJax"}

MTRNord avatar Dec 04 '23 23:12 MTRNord

This also happens with TestLogin/parallel/GET_/login_yields_a_set_of_flows:

❌ TestLogin/parallel/GET_/login_yields_a_set_of_flows (0s)
      apidoc_login_test.go:31: MatchResponse got Content-Type: application/json; charset=utf-8 want application/json - http://127.0.0.1:32803/_matrix/client/v3/login => {"flows":[{"get_login_token":false,"type":"m.login.password"}]}

MTRNord avatar Jan 26 '25 14:01 MTRNord