Skip to content
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

Assertions failing with error "TypeError: string indices must be integers, not str" #38

Closed
rajbg2000 opened this issue Sep 27, 2017 · 1 comment
Assignees

Comments

@rajbg2000
Copy link

rajbg2000 commented Sep 27, 2017

GET request receiving JSON data as string and tool fails to parse this data.

Traceback (most recent call last):
File "rf_client.py", line 780, in
main()
File "rf_client.py", line 774, in main
rfs_test.run(sut)
File "/usr/bin/rfs_test/init.py", line 39, in run
TEST_protocol_details.run(sut, log)
File "/usr/bin/rfs_test/TEST_protocol_details.py", line 5091, in run
assertion_status = Assertion_6_5_8(self, log)
File "/usr/bin/rfs_test/TEST_protocol_details.py", line 4495, in Assertion_6_5_8
resource = json_payload['@odata.context']
TypeError: string indices must be integers, not str

@billdodd billdodd self-assigned this Sep 27, 2017
@billdodd
Copy link
Contributor

I can add some additional checking to be sure the response has been parsed into a JSON object (dict) and thereby avoid the TypeError and early program termination.

The question is why didn't the response get parsed into JSON? From code inspection, the most likely reason would be that the response from the service did not include a Content-Type header with a value that included "application/json".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants