New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tenant, web_util: ensure that the content type is actually application/json #845
Conversation
The rust agent requires Content-Type application/json to be set. Signed-off-by: Thore Sommer <mail@thson.de>
b589eb7
to
ae55730
Compare
As you pointed out the Tornado responses from the verifier had application/x-www-form-urlencoded instead of application/json set as content type. |
It was actually a vkey request rather than the response; I guess it still needs a fix around the call to |
ae55730
to
862fdb2
Compare
@ueno yes you are right. I've now also changed that. Now hopefully I caught every instance where we don't set the correct header. |
862fdb2
to
092f478
Compare
/packit test |
test/test_web_util.py
Outdated
res = web_util.echo_json_response(mock_handler, 200, "Success", test_data) | ||
self.assertTrue(res) | ||
mock_handler.set_status.assert_called_once_with(200) | ||
mock_handler.set_header.assert_called_once_with('Content-Type', 'application/json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're taking out the check of the mock for the method call, but is there another way we can test that the Content-Type
header is set correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really because this is set by the handler which we are mocking. (I can also mock that, but this defeats the purpose of the test)
092f478
to
158ce59
Compare
/packit test |
The test using a tenant command is failing:
@kkaarreell Any way to know what the verifier log contains for that 500 error? |
Not from CI. I would recommend running it using tmt tool as described at the very end of |
Pasting below the content of verifier.log
|
Dumping the data first to a string caused the Content-Type header to be set to application/x-www-form-urlencoded. Now if the request function gets a dict, it is converted to a JSON string and the Content-Type header is set to application/json. Signed-off-by: Thore Sommer <mail@thson.de>
158ce59
to
4cfadda
Compare
I've dropped the commit that changed |
The rust agent requires Content-Type application/json to be set.
This did not happen in two places:
application/x-www-form-urlencoded
, we now manually set it for JSON data.