|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -379,6 +379,12 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|
|
|
|
.expectStatus().isOk().expectBody(String.class).isEqualTo("ACTUATOR: true"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void endpointCanProduceAResponseWithACustomStatus() {
|
|
|
|
|
load((context) -> context.register(CustomResponseStatusEndpointConfiguration.class),
|
|
|
|
|
(client) -> client.get().uri("/customstatus").exchange().expectStatus().isEqualTo(234));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected abstract int getPort(T context);
|
|
|
|
|
|
|
|
|
|
protected void validateErrorBody(WebTestClient.BodyContentSpec body, HttpStatus status, String path,
|
|
|
|
@ -621,6 +627,17 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
@Import(BaseConfiguration.class)
|
|
|
|
|
static class CustomResponseStatusEndpointConfiguration {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
CustomResponseStatusEndpoint customResponseStatusEndpoint() {
|
|
|
|
|
return new CustomResponseStatusEndpoint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Endpoint(id = "test")
|
|
|
|
|
static class TestEndpoint {
|
|
|
|
|
|
|
|
|
@ -847,6 +864,16 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Endpoint(id = "customstatus")
|
|
|
|
|
static class CustomResponseStatusEndpoint {
|
|
|
|
|
|
|
|
|
|
@ReadOperation
|
|
|
|
|
WebEndpointResponse<String> read() {
|
|
|
|
|
return new WebEndpointResponse<>("Custom status", 234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface EndpointDelegate {
|
|
|
|
|
|
|
|
|
|
void write();
|
|
|
|
|