dharmendrakshl1 / rest-assured

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

Set content-type without having the charset appended #355

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I'm testing a REST service which expects a content-type header like:

Content-Type: application/vnd.com.example-v1+json

However, when setting the content-type to this value, either using 
requestSpecObj.contentType(..) or requestSpec.header( ....), rest-assure will 
append "; charset=XXXX" to the header, which is not supported by the REST api 
I'm testing

I haven't find a way to avoid the charset to be appended.
This won't work either:

newConfig().encoderConfig(encoderConfig().appendDefaultContentCharsetToStreaming
ContentTypeIfUndefined(false)

because the content-type needs to be defined. Can a method be added to 
EnconderConfig (or somewhere else) to indicate rest-assured not to append the 
charset?

Thanks for reading this, and thanks for this great library.

Sebastian.

Original issue reported on code.google.com by argo...@gmail.com on 15 Sep 2014 at 9:44

GoogleCodeExporter commented 9 years ago
I've added a "appendDefaultContentCharsetToContentTypeIfUndefined" method to 
EncoderConfig. Try it out by depending on version 2.3.4-SNAPSHOT after having 
added the following repo:

<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 15 Sep 2014 at 12:58

GoogleCodeExporter commented 9 years ago
Thanks, that was fast! it is working now :D

Original comment by argo...@gmail.com on 16 Sep 2014 at 3:48