Merge branch '2.0.x'
This commit is contained in:
@@ -55,7 +55,7 @@ public final class WebFluxTags {
|
||||
* @return the method tag whose value is a capitalized method (e.g. GET).
|
||||
*/
|
||||
public static Tag method(ServerWebExchange exchange) {
|
||||
return Tag.of("method", exchange.getRequest().getMethod().toString());
|
||||
return Tag.of("method", exchange.getRequest().getMethodValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,12 +21,16 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
|
||||
import org.springframework.mock.web.server.MockServerWebExchange;
|
||||
import org.springframework.web.reactive.HandlerMapping;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Tests for {@link WebFluxTags}.
|
||||
@@ -80,4 +84,14 @@ public class WebFluxTagsTests {
|
||||
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodTagToleratesNonStandardHttpMethods() {
|
||||
ServerWebExchange exchange = mock(ServerWebExchange.class);
|
||||
ServerHttpRequest request = mock(ServerHttpRequest.class);
|
||||
given(exchange.getRequest()).willReturn(request);
|
||||
given(request.getMethodValue()).willReturn("CUSTOM");
|
||||
Tag tag = WebFluxTags.method(exchange);
|
||||
assertThat(tag.getValue()).isEqualTo("CUSTOM");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user