Closed GoogleCodeExporter closed 8 years ago
I managed to compile rest-assured using IDEA. The above code is wrong,
multiPart(String, Object,..) will not work because otherwise you cannot
distinguish between File, String and objects to serialize.
Therefore I introduced a new function in Interface RequestSpecification:
RequestSpecification multiPartObject(String name, Object object, String mimeType);
and changed the implementation to:
def RequestSpecification multiPartObject(String name, Object object, String mimeType) {
// assert
notNull object, "object"
// serialize
def serializedObject = isSerializableCandidate(object) ?
ObjectMapping.serialize(object, mimeType, null) :
object.toString()
// add it to the multiParts list
multiParts << new MultiPart(name: name, content: serializedObject, mimeType: mimeType)
this
}
This works, but the Content-Type is not included, which makes problems at the
server side, something I couldn't solve.
Original comment by MailKont...@gmail.com
on 24 Apr 2012 at 10:12
Hi,
Thanks for the detailed report and for your effort in trying to fix it. The
issue with the content-type that is not included could be related to issue 167.
Original comment by johan.ha...@gmail.com
on 26 Apr 2012 at 7:08
Thank you! Maybe you find a better name than "multiPartObject".
Just a note: your unit tests (XML serialization) are platform dependent. On
windows you got "\r\n", which leads to an assert failure. During the
implementation I disabled the tests.
Original comment by MailKont...@gmail.com
on 26 Apr 2012 at 7:41
Thanks for pointing. Actually there are worse problems with the tests since
they only work in Maven 2 (at least for me) because all tests extend from the
"WithJetty" which is Maven 2 dependent. The problem is, as always, to find time
to fix it :)
Original comment by johan.ha...@gmail.com
on 26 Apr 2012 at 7:56
Original comment by johan.ha...@gmail.com
on 9 May 2012 at 2:15
I've now fixed this in trunk. If you want to try it out depend on version
1.6.2-SNAPSHOT after having added the following repo to your pom.xml:
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots />
</repository>
</repositories>
Original comment by johan.ha...@gmail.com
on 23 May 2012 at 11:27
Works! Thank you very much!
Original comment by MailKont...@gmail.com
on 30 May 2012 at 12:03
Original issue reported on code.google.com by
MailKont...@gmail.com
on 23 Apr 2012 at 1:07