Fix direction of arrows in request/response output

This commit is contained in:
Rossen Stoyanchev 2017-02-20 18:38:15 -05:00
parent e6401b29e6
commit 2515134f8e
1 changed files with 5 additions and 5 deletions

View File

@ -167,12 +167,12 @@ public class ExchangeResult {
public String toString() {
return "\n" +
"> " + getMethod() + " " + getUrl() + "\n" +
"> " + formatHeaders(getRequestHeaders()) + "\n" +
"> " + formatHeaders("> ", getRequestHeaders()) + "\n" +
"\n" +
formatContent(getRequestHeaders().getContentType(), getRequestContent()) + "\n" +
"\n" +
"> " + getStatus() + " " + getStatusReason() + "\n" +
"> " + formatHeaders(getResponseHeaders()) + "\n" +
"< " + getStatus() + " " + getStatusReason() + "\n" +
"< " + formatHeaders("< ", getResponseHeaders()) + "\n" +
"\n" +
formatContent(getResponseHeaders().getContentType(), getResponseContent()) + "\n\n";
}
@ -185,10 +185,10 @@ public class ExchangeResult {
return reason;
}
private String formatHeaders(HttpHeaders headers) {
private String formatHeaders(String linePrefix, HttpHeaders headers) {
return headers.entrySet().stream()
.map(entry -> entry.getKey() + ": " + entry.getValue())
.collect(Collectors.joining("\n> "));
.collect(Collectors.joining("\n" + linePrefix));
}
private String formatContent(MediaType contentType, MonoProcessor<byte[]> body) {