@Test public void logsRequestsAndResponsesShort() { interceptor = new HttpMessageLoggingInterceptor(false, httpMessageFormatter); LiveHttpRequest request = get("/") .header("ReqHeader", "ReqHeaderValue") .cookies(requestCookie("ReqCookie", "ReqCookieValue")) .build(); consume(interceptor.intercept(request, chain( response(OK) .header("RespHeader", "RespHeaderValue") .cookies(responseCookie("RespCookie", "RespCookieValue").build()) ))); String requestPattern = "request=\\{version=HTTP/1.1, method=GET, uri=/, id=" + request.id() + "\\}"; String responsePattern = "response=\\{version=HTTP/1.1, status=200 OK\\}"; assertThat(responseLogSupport.log(), contains( loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, origin=null, " + requestPattern), loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, " + responsePattern))); }
@Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); }
HttpMessageLoggingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); } }
HttpMessageLoggingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); } HttpMessageLoggingInterceptor(boolean longFormatEnabled, HttpMessageFormatter httpMessageFormatter); }
HttpMessageLoggingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); } HttpMessageLoggingInterceptor(boolean longFormatEnabled, HttpMessageFormatter httpMessageFormatter); @Override Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain); }
HttpMessageLoggingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); } HttpMessageLoggingInterceptor(boolean longFormatEnabled, HttpMessageFormatter httpMessageFormatter); @Override Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain);  }