org.springframework.web.reactive.function

当我的代码是这样的时会出现错误:


@Test

public void getTemplateByIdTest() throws Exception {

    client.get().uri("/template/getTemplate/7")

            .exchange()

            .expectStatus().isOk()

            .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8)

            .expectBody(VtTemplateVO.class)

            .returnResult();

}

当我像这样更改我的代码时,就可以了!


@Test

public void getTemplateByIdTest() throws Exception {

    client.get().uri("/template/getTemplate/7")

            .exchange()

            .expectStatus().isOk()

            .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8)

            .expectBody(String.class)

            .returnResult();

}

为什么我用的.expectBody(VtTemplateVO.class)时候会说org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/json;charset=UTF-8' not supported


有人知道吗?请帮忙,谢谢


喵喔喔
浏览 539回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java