Support for sending raw request bodies
There is no way to send a raw request body (e.g. a binary file), everything is UTF-8 encoded.
Webtest supports this somehow, so should this library.
Note to self: Perhaps Get Binary File [http://robotframework.googlecode.com/hg/doc/libraries/OperatingSystem.html?r=2.8.1#Get_Binary_File] in combination with Set Request Body works.
Hi @peritus ,
I tried to use "Set Request Body" and "Get Binary File" but getting following error:
20150414 18:05:42.999 : DEBUG : Response headers: 20150414 18:05:42.999 : DEBUG : date: Tue, 14 Apr 2015 10:00:42 GMT 20150414 18:05:43.000 : DEBUG : content-length: 0 20150414 18:05:43.000 : DEBUG : server: Apache-Coyote/1.1 20150414 18:05:43.000 : DEBUG : No response body received 20150414 18:05:43.001 : FAIL : Request should have succeeded, but was "415 Unsupported Media Type". 20150414 18:05:43.002 : DEBUG : Traceback (most recent call last): File "c:\Python27\lib\site-packages\HttpLibrary__init__.py", line 248, in POST self.context.request_headers, **kwargs) File "c:\Python27\lib\site-packages\HttpLibrary__init__.py", line 102, in post_process_request self.response.status
20150414 18:05:43.001 : FAIL : Request should have succeeded, but was "415 Unsupported Media Type".
If there is no response body, you can't retrieve it.
Hi @peritus ,
Thanks for your reply.
When I execute api using rest client to upload file. It works fine.
I was trying to automate it, but it is failing with error 415.
Below is the complete log:
Starting test: Automation.Test Suite.file upload 20150415 09:01:01.876 : TRACE : Arguments: [ u'192.168.1.1:8080' | u'http' ] 20150415 09:01:01.876 : INFO : Host for next HTTP request set to '192.168.1.1:8080' 20150415 09:01:01.876 : INFO : Scheme for next HTTP request set to 'http' 20150415 09:01:01.876 : TRACE : Return: None 20150415 09:01:01.876 : TRACE : Arguments: [ u'g:\new.csv' | encoding=u'UTF-8' ] 20150415 09:01:01.876 : INFO : Getting file 'g:\new.csv' 20150415 09:01:01.876 : TRACE : Return: "ID","Domain","URL"\n"24441","http://www.mycompany.com","http://www.mycompany.com"' 20150415 09:01:01.876 : INFO : ${Request_Body} = "ID","Domain","URL" "24441","http://www.mycompany.com","http://www.mycompany.com" 20150415 09:01:01.886 : TRACE : Arguments: [ u'Content-Type' | u'application/vnd.ms-excel' ] 20150415 09:01:01.886 : INFO : Set request header "Content-Type" to "application/vnd.ms-excel" 20150415 09:01:01.886 : TRACE : Return: None 20150415 09:01:01.886 : TRACE : Arguments: [ u'\ufeff"ID","Domain","URL"\n"24441","http://www.mycompany.com","http://www.mycompany.com"' ] 20150415 09:01:01.886 : INFO : Request body set to ""ID","Domain","URL" "24441","http://www.mycompany.com","http://www.mycompany.com"". 20150415 09:01:01.886 : TRACE : Return: None 20150415 09:01:01.886 : TRACE : Arguments: [ u'/fileUpload' ] 20150415 09:01:01.886 : DEBUG : Performing POST request on http://192.168.1.1:8080/fileUpload 20150415 09:01:01.886 : DEBUG : Request headers: 20150415 09:01:01.886 : DEBUG : Host: 192.168.1.1:8080 20150415 09:01:01.886 : DEBUG : Content-Type: application/vnd.ms-excel 20150415 09:01:01.886 : DEBUG : Request body: 20150415 09:01:01.886 : DEBUG : "ID","Domain","URL" "24441","http://www.mycompany.com","http://www.mycompany.com" 20150415 09:01:01.906 : DEBUG : Response status line: 415 Unsupported Media Type 20150415 09:01:01.906 : DEBUG : Response headers: 20150415 09:01:01.906 : DEBUG : date: Wed, 15 Apr 2015 00:56:01 GMT 20150415 09:01:01.906 : DEBUG : content-length: 0 20150415 09:01:01.906 : DEBUG : server: Apache-Coyote/1.1 20150415 09:01:01.906 : DEBUG : No response body received 20150415 09:01:01.906 : FAIL : Request should have succeeded, but was "415 Unsupported Media Type". 20150415 09:01:01.916 : DEBUG : Traceback (most recent call last): File "c:\Python27\lib\site-packages\HttpLibrary__init__.py", line 248, in POST self.context.request_headers, **kwargs) File "c:\Python27\lib\site-packages\HttpLibrary__init__.py", line 102, in post_process_request self.response.status Ending test: Automation.Test Suite.file upload