Hi
I am trying to validate that a response has the content type application/x-javascript.
I cannot use
expect().contentType(ContentType.JSONP).when().get(url);
because there is no such enum constant. I tried
expect().contentType(is("application/x-javascript")).when().get(url);
but that I got a 500 from Tomcat with the following beginning of a stack trace:
SEVERE: Servlet.service() for servlet mvc threw exception
java.lang.IllegalArgumentException: Invalid token character ' ' in token "is "application"
at org.springframework.http.MediaType.checkToken(MediaType.java:352)
at org.springframework.http.MediaType.<init>(MediaType.java:324)
Yes I am using
org.hamcrest.Matchers.is here, but you see the problem: the "is" somehow got confused with its argument. I am not sure if this is a hamcrest problem, a tomcat problem, a Rest-Assured problem, or a me problem.
Note that I *can* just say
expect().contentType("application/x-javascript").when().get(url);
but I thought the issue with the hamcrest matcher was interesting. Is this worth filing an issue about?
Thanks