I am using Spring Restdocs for documentation. Here's my code:
RestDocumentationResultHandler document = document("{class-name}/{method-name}",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()));
String authHead = TestUtils.performLogin(mockMvc, "user", "pass");
mockMvc
.perform(get("/svc/service")
)
.andExpect(status().is(200))
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.childs").isArray())
.andDo(document);
}
.adoc files are successfully generated and af there's an error that I am struggling to solve it.
[Fatal Error] :1:1: Premature end of file.
ERROR: 'Premature end of file.'
I think the problem comes from
preprocessResponse(prettyPrint())
Since i commented it out, the error disappears. But JSON response is NOT formated as i expected. I really appreciate your help. Thanks in advance.