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

'put request' failed with octet-stream file #212

Open
mangobowl opened this issue Nov 21, 2018 · 3 comments
Open

'put request' failed with octet-stream file #212

mangobowl opened this issue Nov 21, 2018 · 3 comments

Comments

@mangobowl
Copy link

mangobowl commented Nov 21, 2018

Put Request failed with sending octet-stream file, for example:

Create Session | ${session_name} | http://upload.mytestaddress.com/upload | timeout=60 | max_retries=0
${file_data} | Get Binary File | D:\\\\DSC_6613.jpg
${LocalHeader} | Create Dictionary | Content-type=application/octet-stream
${response}= | Put Request | ${session_name}  | /System/deviceInfo | ${file_data} | headers=${LocalHeader}

which will get error:

FAIL : UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte

btw, if using Put keyword instead of Put Request, it won't get error.

@vkosuri
Copy link
Contributor

vkosuri commented Nov 27, 2018

can you try

${LocalHeader} | Create Dictionary | Content-type=application/x-www-form-urlencoded

@mangobowl
Copy link
Author

mangobowl commented Nov 28, 2018

@vkosuri I tried and got the same error.

I found where that exception came from:

https://github.com/bulkan/robotframework-requests/blob/11baa3277f1cb728712e26d996200703c15254a8/src/RequestsLibrary/RequestsKeywords.py#L816

and I don't understand why the data need to be decoded? Maybe this is unnecessary for octet-file data?

@vkosuri
Copy link
Contributor

vkosuri commented Nov 30, 2018

@mangobowl could you try to enable debug flag on create session?

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