Hello,
I saw there's been some great fixes and enhancements the past few months! So I've decided to move up to the latest version (2.3.0), but ran into an issue.
I think I've narrowed it down to a fix in 2.2.0 for:
Fixed an issue with content-type identification when passing in content-type header manually using a header.
I'm wonder what the issue was? Things were working for me until I upgraded to 2.2.0. It may be an issue on my end -- I may need to tweak the way I write my tests, our api, etc.
I started writing my tests in 1.8.1 as i.e.:
final RequestSpecification request = given().
header("Content-Type", "application/json").
body("{foo:bar}");
final ResponseSpecification response = expect().
....
given(request, response).post("resource/loc);
This was working great until I moved up to 2.2.0. I now get an unsupported media type from our api:
Request method: POST
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Headers: Content-Type=application/json
Cookies: <none>
Body:
{foo:bar'}}
HTTP/1.1 415 Unsupported Media Type
Server: nginx/0.7.67
Date: Fri, 24 Jan 2014 21:34:32 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: JSESSIONID=app-37gz27w6gckapgujztyzdu2fr.app-3;Path=/
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
"meta": {
"success": false,
"status": 415,
"error_code": "invalid_content_type",
"error_desc": "Resources must be sent with Content-Type='application/json' header."
}
}
To Note: In 1.8.1, I had to manually specify the content-type in my header, or else I would get the same error as below.