Search in sources :

Example 6 with HttpRequestMessageLogger

use of com.hotels.styx.common.logging.HttpRequestMessageLogger in project styx by ExpediaGroup.

the class HttpRequestMessageLoggerTest method logsClientSideRequestShortFormat.

@Test
public void logsClientSideRequestShortFormat() {
    LiveHttpRequest styxRequest = get("http://www.hotels.com/foo/bar/request").build();
    new HttpRequestMessageLogger("com.hotels.styx.http-messages.outbound", false, httpMessageFormatter).logRequest(styxRequest, origin, true);
    assertThat(log.lastMessage(), is(loggingEvent(INFO, format("requestId=%s, secure=true, origin=%s, request=\\{version=HTTP/1.1, method=GET, uri=%s, id=%s}", styxRequest.id(), origin, styxRequest.url(), styxRequest.id()))));
}
Also used : HttpRequestMessageLogger(com.hotels.styx.common.logging.HttpRequestMessageLogger) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

HttpRequestMessageLogger (com.hotels.styx.common.logging.HttpRequestMessageLogger)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Test (org.junit.jupiter.api.Test)5 LiveHttpRequest (com.hotels.styx.api.LiveHttpRequest)4 LiveHttpResponse (com.hotels.styx.api.LiveHttpResponse)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)1