Skip to content

Commit 2d60a0f

Browse files
enhance JSON processing error message
1 parent 473de71 commit 2d60a0f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/cucumber/tutorial/util/PlainHttpResponseUtils.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ public static PlainHttpResponse from(String content) {
3232
return mapper.readValue(content, PlainHttpResponse.class);
3333
} catch (JsonProcessingException e) {
3434
throw new RuntimeException("Cannot convert to PlainHttpResponse object:\n" + content+"\n\nExpected:\n{\n" +
35-
" [optional] \"status\": <object>,\n" +
36-
" [optional] \"reason\": \"<text>\",\n" +
37-
" [optional] \"body\": <object>,\n" +
38-
" [optional] \"headers\": <json array> ex: [ {\"h1\": \"v1\"}, {\"h2\": \"v2\"} ]\n" +
39-
"}", e); }
35+
" [optional] \"status\": <JsonNode>,\n" +
36+
" [optional] \"reason\": \"<TextNode>\",\n" +
37+
" [optional] \"body\": <JsonNode>,\n" +
38+
" [optional] \"headers\": <ArrayNode> ex: [ {\"h1\": \"v1\"}, {\"h2\": \"v2\"} ]\n" +
39+
"}", e);
40+
}
4041
}
4142

4243
public static PlainHttpResponse from(ClassicHttpResponse response) {

0 commit comments

Comments
 (0)