use of ch.qos.logback.access.spi.IAccessEvent in project logback-access-spring-boot-starter by akihyro.
the class AbstractLogbackAccessEventsTest method logbackAccessEventWithRequestHeader.
/**
* Tests a Logback-access event with a request header.
*/
@Test
public void logbackAccessEventWithRequestHeader() {
RequestEntity<Void> request = RequestEntity.get(rest.getRestTemplate().getUriTemplateHandler().expand("/test/text")).header("X-Test-Header", "TEST-HEADER").build();
ResponseEntity<String> response = rest.exchange(request, String.class);
IAccessEvent event = LogbackAccessEventQueuingAppender.appendedEventQueue.pop();
LogbackAccessEventQueuingListener.appendedEventQueue.pop();
assertThat(response).hasStatusCode(HttpStatus.OK);
assertThat(event).hasRequestHeaderName("X-Test-Header").hasRequestHeader("X-Test-Header", "TEST-HEADER").hasRequestHeaderInMap("X-Test-Header", "TEST-HEADER");
}
use of ch.qos.logback.access.spi.IAccessEvent in project logback-access-spring-boot-starter by akihyro.
the class AbstractLogbackAccessEventsTest method logbackAccessEventWithResponseHeader.
/**
* Tests a Logback-access event with a response header.
*/
@Test
public void logbackAccessEventWithResponseHeader() {
ResponseEntity<String> response = rest.getForEntity("/test/text-with-header", String.class);
IAccessEvent event = LogbackAccessEventQueuingAppender.appendedEventQueue.pop();
LogbackAccessEventQueuingListener.appendedEventQueue.pop();
assertThat(response).hasStatusCode(HttpStatus.OK);
assertThat(event).hasResponseHeaderName("X-Test-Header").hasResponseHeader("X-Test-Header", "TEST-HEADER").hasResponseHeaderInMap("X-Test-Header", "TEST-HEADER");
}
use of ch.qos.logback.access.spi.IAccessEvent in project logback-access-spring-boot-starter by akihyro.
the class UndertowServerPortUnusingTest method logbackAccessEvent.
/** {@inheritDoc} */
@Override
public void logbackAccessEvent() {
RequestEntity<Void> request = RequestEntity.get(rest.getRestTemplate().getUriTemplateHandler().expand("/test/text")).header("X-Forwarded-Host", "forwarded-host").header("X-Forwarded-Port", "12345").build();
ResponseEntity<String> response = rest.exchange(request, String.class);
IAccessEvent event = LogbackAccessEventQueuingAppender.appendedEventQueue.pop();
LogbackAccessEventQueuingListener.appendedEventQueue.pop();
assertThat(response).hasStatusCode(HttpStatus.OK);
assertThat(event).hasLocalPort(port);
}
Aggregations