djangid / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Not able to read content of the file which has parsed in multiPart() method #402

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1.
> I have created tenantAdd() method - to add a tenant user by taking json input 
in a text file using multipart() method.
> Manually using POST REST client /using body() method when I parse the json 
input it works fine, but using multipart() method it is not working.

> Method:
 =======

      public static void tenantAdd(){
        Response res=given().headers("Accept","application/json")
.contentType("application/json")
.multiPart(newFile("file","D:/t/json.txt"))
.log().everything().when().post("/sites/"+id+"/tenants");
                res.prettyPrint();
      }

> D:/t/json.txt file input:
 ========================
 {
 "name" : "Test ",
 "description" : "administration tenant", "password" : "Test_123", "email" : " test@test.com "
 }

 It is failing with below error:
 ==============================
> {
>      "detail": "Create tenant fails, cause: null",
>      "title": "Internal Server Error caused by unexpected exception",
>      "errorCode": "EMVI-WS-11019",
>      "problemType": "http://www.w3.org/Protocols/HTTP/HTRESP.html",
>      "httpStatus": 500,
>      "httpMessage": "Internal error 'An error occurred while creating object 
from json String.' encountered while accessing 'Site' resource identified by 
'/em/websvcs/restful/extws/virtualization/infrastructure/v1/sites/<id>/tenants'"
,
>      "problemInstance": 
"/em/websvcs/restful/extws/virtualization/infrastructure/v1/sites/<id>/tenants"
> }

What is the expected output? What do you see instead?
> Output:
> ======
> Request method:   POST
> Request 
path:   https://<IP:PORT>/em/websvcs/restful/extws/virtualization/infrastructure/v
1/sites/<id>/tenants
> Proxy:            <none>
> Request params:   <none>
> Query params: <none>
> Form params:  <none>
> Path params:  <none>
> Multiparts:       <none>
> Headers:      Accept=*/*
>               Content-Type=application/json; charset=ISO-8859-1
> Cookies:      <none>
> Body:
> {
>      "name": "Test",
>      "description": " administration tenant ",
>      "password": "Test_123",
>      "email": "test@test.com"
> }

What version of the product are you using? On what operating system?
Rest assured - 2.4.1
OS win7

Please provide any additional information below.

Original issue reported on code.google.com by ranis...@gmail.com on 17 May 2015 at 6:20

Attachments:

GoogleCodeExporter commented 8 years ago
I would appreciate if someone can update on this issue.

Original comment by ranis...@gmail.com on 18 May 2015 at 5:51

GoogleCodeExporter commented 8 years ago
Could it be some charset issues? Perhaps you can try specifying 
charset/mimetype when sending the multipart request?

Original comment by johan.ha...@gmail.com on 7 Jun 2015 at 4:47