Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
7efa1e47
Commit
7efa1e47
authored
Nov 20, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x' into 2.3.x
Closes gh-24222
parents
0ed7f7f4
12f2529b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
AbstractWebFluxEndpointHandlerMapping.java
...t/web/reactive/AbstractWebFluxEndpointHandlerMapping.java
+1
-2
AbstractWebMvcEndpointHandlerMapping.java
...int/web/servlet/AbstractWebMvcEndpointHandlerMapping.java
+1
-1
AbstractWebEndpointIntegrationTests.java
...t/web/annotation/AbstractWebEndpointIntegrationTests.java
+27
-0
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java
View file @
7efa1e47
...
...
@@ -361,8 +361,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
WebEndpointResponse
<?>
webEndpointResponse
=
(
WebEndpointResponse
<?>)
response
;
return
new
ResponseEntity
<>(
webEndpointResponse
.
getBody
(),
HttpStatus
.
valueOf
(
webEndpointResponse
.
getStatus
()));
return
ResponseEntity
.
status
(
webEndpointResponse
.
getStatus
()).
body
(
webEndpointResponse
.
getBody
());
}
@Override
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java
View file @
7efa1e47
...
...
@@ -367,7 +367,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
return
result
;
}
WebEndpointResponse
<?>
response
=
(
WebEndpointResponse
<?>)
result
;
return
new
ResponseEntity
<
Object
>(
response
.
getBody
(),
HttpStatus
.
valueOf
(
response
.
getStatus
()
));
return
ResponseEntity
.
status
(
response
.
getStatus
()).
body
(
response
.
getBody
(
));
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java
View file @
7efa1e47
...
...
@@ -380,6 +380,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
,
...
...
@@ -624,6 +630,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
{
...
...
@@ -850,6 +867,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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment