@Test public void logsRequestsAndResponses() { LiveHttpRequest request = get("/") .version(HttpVersion.HTTP_1_1) .header("ReqHeader", "ReqHeaderValue") .cookies(requestCookie("ReqCookie", "ReqCookieValue")) .build(); consume(interceptor.intercept(request, chain( response(OK) .header("RespHeader", "RespHeaderValue") .cookies(responseCookie("RespCookie", "RespCookieValue").build()) ))); assertThat(responseLogSupport.log(), contains( loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, origin=null, request=" + FORMATTED_REQUEST), loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, response=" + FORMATTED_RESPONSE))); }
@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);  }