asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
205 stars 84 forks source link

No way to use a nested dictionary to a header. #72

Closed technigirl closed 2 years ago

technigirl commented 5 years ago

I am trying to build an auth header which consists of a nested dictionary/JSON. Unfortunately this doesn't seem to be possible anymore. The header dictionary looks like this:

{"X-Docusign-Authentication": {"Username":"${docusign_username}","Password":"${docusign_password}","IntegratorKey":"${DOCUSIGN_API_KEY}"}}

This is a valid JSON format. However, when I pass it in with the Set Headers keyword, I get the following error:

InvalidHeader: Value for header {X-Docusign-Authentication: {'Username': '${docusign_username}', 'Password': '${docusign_password}', 'IntegratorKey': '${DOCUSIGN_API_KEY}'}} must be of type str or bytes, not <class 'dict'>

I tried converting this to a string directly in RF, but I still get this error. I think it may be due to this issue: https://github.com/kennethreitz/requests/issues/4333

I am guessing that the RESTinstance library interprets the input as a dictionary no matter what I format it to.

So far I have not found a workaround for this issue, aside from not using this library. Would be great to have the Set Headers keyword updated to accept strings, or to automatically convert the dictionary to a string.

Atihinen commented 3 years ago

Please can you share the robot keyword command that you're using?

Run also the test with --loglevel debug and provide the stack trace from the logs

Atihinen commented 2 years ago

Closing this issue. If the issue still exists please reopen.