Issue
Here's my test :
@Test
fun `test config properties`() {
mockMvc.request(HttpMethod.GET,"someUrl") {
accept = MediaType.TEXT_PLAIN
}.andExpect {
status { isOk }
content { contentType(MediaType.TEXT_PLAIN) }
}
}
and it fails with this:
Expected :text/plain Actual :text/plain;charset=UTF-8
This is using the Kotlin DSL for MockMVC.
How do I change the accept to allow for charset=UTF-8 ?
Solution
There is one factory method which accepts custom value. Try:
MediaType.valueOf("text/plain;charset=UTF-8")
Answered By - Goro
Answer Checked By - Mary Flores (JavaFixing Volunteer)