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

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

Closed
johanhaleby opened this issue Jul 20, 2015 · 2 comments

Comments

@johanhaleby
Copy link
Collaborator




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:

@johanhaleby
Copy link
Collaborator Author

I would appreciate if someone can update on this issue.

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

@johanhaleby
Copy link
Collaborator Author

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

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

No branches or pull requests

1 participant