Closed GoogleCodeExporter closed 9 years ago
Could you provide an example for this? Or know of a website that I can use to
try it out?
Original comment by johan.ha...@gmail.com
on 21 May 2014 at 1:48
Also what error message do you get?
Original comment by johan.ha...@gmail.com
on 21 May 2014 at 1:49
Here is my scenario,
I have a form (consider it's like user registration form) where i can enter
details like
username(String),address(String),photo(octetSteam/inputstream).
for this i can able to 'post' multipart/form-data like as follows using Rest
assure
File photoFile = new File("test.jpg");
given().multiPart("username", "TestUser").multiPart("photo",
"testAddress").when().post("/user");
Following are the my scenarios to test
1) To get user details i have a rest API like GET '/user/{userId}' which gives
user data interms of 'multipart/form-data'
2) To update only photo rest api PUT '/user/{userID}/photo' which accepts
'application/octet-stream'
3) After updating i want to GET '/user/{userID}/photo' which give
'application/octet-stream'
so that i can verify whether previous PUT is updated my 'photo' or not?
How i can use Rest assure to test above 3 cases?
thanks in advance
-
Chakrapani.Ch
Original comment by chchakra...@gmail.com
on 22 May 2014 at 6:04
So which part fails? Is it the first operation (1)?
Original comment by johan.ha...@gmail.com
on 22 May 2014 at 6:07
Yes first one is failing and regarding 2nd,3rd is i want to know REST assure is
supporting these type of operations?
Original comment by chchakra...@gmail.com
on 22 May 2014 at 6:35
[deleted comment]
And what error do you get? 2nd and 3rd should work with RA.
Original comment by johan.ha...@gmail.com
on 22 May 2014 at 6:42
here is my sample code
1)InputStream is1 = given().get("/user/{useId}/photo", 123).asInputStream();
2)given().contentType("application/octet-stream").content(IOUtils.toByteArray(is
1)).put("/user/{useId}/photo", 123);
here 1) is working fine (i have verified this inputStream by saving in local
file system.but in 2)line it's saving 0KB.
after these 2 statements,i can see a file with 0KB.
Original comment by chchakra...@gmail.com
on 22 May 2014 at 6:54
Oh so (1) actually works? Are you having issues with the uploading part? Are
you sure that you shouldn't use multi-part form data uploading for the PUT
requests as well?
Original comment by johan.ha...@gmail.com
on 22 May 2014 at 6:59
in comment-8 i have discussed about issue (2) mentioned in comment-3.
Original comment by chchakra...@gmail.com
on 22 May 2014 at 7:06
But you still have problems with (1)? Or is (1) the root of the problem? Is
IOUtils.toByteArray(..) returning a valid byte-array?
What version of REST Assured are you using?
Original comment by johan.ha...@gmail.com
on 22 May 2014 at 7:52
Closed due to inactivity
Original comment by johan.ha...@gmail.com
on 23 Sep 2014 at 9:15
Original issue reported on code.google.com by
chchakra...@gmail.com
on 20 May 2014 at 1:57