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
1721aecc
Commit
1721aecc
authored
Jan 30, 2020
by
Johnny Lim
Committed by
Stephane Nicoll
Mar 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ServerHttpResponse.getRawStatusCode() in WebFluxTags
See gh-19987
parent
8f61a4bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
WebFluxTags.java
...boot/actuate/metrics/web/reactive/server/WebFluxTags.java
+3
-6
WebFluxTagsTests.java
...actuate/metrics/web/reactive/server/WebFluxTagsTests.java
+3
-3
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java
View file @
1721aecc
...
@@ -22,7 +22,6 @@ import io.micrometer.core.instrument.Tag;
...
@@ -22,7 +22,6 @@ import io.micrometer.core.instrument.Tag;
import
org.springframework.boot.actuate.metrics.http.Outcome
;
import
org.springframework.boot.actuate.metrics.http.Outcome
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.server.reactive.AbstractServerHttpResponse
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.HandlerMapping
;
...
@@ -164,11 +163,9 @@ public final class WebFluxTags {
...
@@ -164,11 +163,9 @@ public final class WebFluxTags {
private
static
Integer
extractStatusCode
(
ServerWebExchange
exchange
)
{
private
static
Integer
extractStatusCode
(
ServerWebExchange
exchange
)
{
ServerHttpResponse
response
=
exchange
.
getResponse
();
ServerHttpResponse
response
=
exchange
.
getResponse
();
if
(
response
instanceof
AbstractServerHttpResponse
)
{
Integer
statusCode
=
response
.
getRawStatusCode
();
Integer
statusCode
=
((
AbstractServerHttpResponse
)
response
).
getStatusCodeValue
();
if
(
statusCode
!=
null
)
{
if
(
statusCode
!=
null
)
{
return
statusCode
;
return
statusCode
;
}
}
}
HttpStatus
status
=
response
.
getStatusCode
();
HttpStatus
status
=
response
.
getStatusCode
();
return
(
status
!=
null
)
?
status
.
value
()
:
null
;
return
(
status
!=
null
)
?
status
.
value
()
:
null
;
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java
View file @
1721aecc
...
@@ -21,8 +21,8 @@ import org.junit.jupiter.api.BeforeEach;
...
@@ -21,8 +21,8 @@ import org.junit.jupiter.api.BeforeEach;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.server.reactive.AbstractServerHttpResponse
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.mock.http.server.reactive.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.MockServerHttpRequest
;
import
org.springframework.mock.web.server.MockServerWebExchange
;
import
org.springframework.mock.web.server.MockServerWebExchange
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.HandlerMapping
;
...
@@ -123,9 +123,9 @@ class WebFluxTagsTests {
...
@@ -123,9 +123,9 @@ class WebFluxTagsTests {
void
outcomeTagIsSuccessWhenResponseStatusIsAvailableFromUnderlyingServer
()
{
void
outcomeTagIsSuccessWhenResponseStatusIsAvailableFromUnderlyingServer
()
{
ServerWebExchange
exchange
=
mock
(
ServerWebExchange
.
class
);
ServerWebExchange
exchange
=
mock
(
ServerWebExchange
.
class
);
ServerHttpRequest
request
=
mock
(
ServerHttpRequest
.
class
);
ServerHttpRequest
request
=
mock
(
ServerHttpRequest
.
class
);
AbstractServerHttpResponse
response
=
mock
(
Abstract
ServerHttpResponse
.
class
);
ServerHttpResponse
response
=
mock
(
ServerHttpResponse
.
class
);
given
(
response
.
getStatusCode
()).
willReturn
(
HttpStatus
.
OK
);
given
(
response
.
getStatusCode
()).
willReturn
(
HttpStatus
.
OK
);
given
(
response
.
get
StatusCodeValu
e
()).
willReturn
(
null
);
given
(
response
.
get
RawStatusCod
e
()).
willReturn
(
null
);
given
(
exchange
.
getRequest
()).
willReturn
(
request
);
given
(
exchange
.
getRequest
()).
willReturn
(
request
);
given
(
exchange
.
getResponse
()).
willReturn
(
response
);
given
(
exchange
.
getResponse
()).
willReturn
(
response
);
Tag
tag
=
WebFluxTags
.
outcome
(
exchange
);
Tag
tag
=
WebFluxTags
.
outcome
(
exchange
);
...
...
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