This is an automated email from the ASF dual-hosted git repository. liuhongyu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push: new f27c5728f9 fix divide logging request method (#5607) f27c5728f9 is described below commit f27c5728f9285244ce74f6ba9a7cb872b062260e Author: crudboy <965211...@qq.com> AuthorDate: Mon Aug 5 14:50:33 2024 +0800 fix divide logging request method (#5607) --- .../shenyu/plugin/divide/context/DivideShenyuContextDecorator.java | 2 +- .../plugin/divide/context/DivideShenyuContextDecoratorTest.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecorator.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecorator.java index 0b85459774..82a9349e61 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecorator.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecorator.java @@ -33,7 +33,7 @@ public class DivideShenyuContextDecorator implements ShenyuContextDecorator { @Override public ShenyuContext decorator(final ShenyuContext shenyuContext, final MetaData metaData) { String path = shenyuContext.getPath(); - shenyuContext.setMethod(path); + shenyuContext.setMethod(shenyuContext.getHttpMethod()); shenyuContext.setRealUrl(path); shenyuContext.setRpcType(RpcTypeEnum.HTTP.getName()); shenyuContext.setModule(Optional.ofNullable(metaData).map(MetaData::getAppName) diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/test/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecoratorTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/test/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecoratorTest.java index 3800229998..1d388befa7 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/test/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecoratorTest.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/test/java/org/apache/shenyu/plugin/divide/context/DivideShenyuContextDecoratorTest.java @@ -35,6 +35,8 @@ public final class DivideShenyuContextDecoratorTest { private static final String MOCK_CONTEXT_PATH = "mockContextPath"; + private static final String MOCK_METHOD = "GET"; + private DivideShenyuContextDecorator divideShenyuContextDecorator; @BeforeEach @@ -50,8 +52,9 @@ public final class DivideShenyuContextDecoratorTest { MetaData metaData = new MetaData(); ShenyuContext shenyuContext = new ShenyuContext(); shenyuContext.setPath(MOCK_CONTEXT_PATH); + shenyuContext.setHttpMethod(MOCK_METHOD); ShenyuContext decorator = divideShenyuContextDecorator.decorator(shenyuContext, metaData); - assert MOCK_CONTEXT_PATH.equals(decorator.getMethod()); + assert MOCK_METHOD.equals(decorator.getMethod()); assert MOCK_CONTEXT_PATH.equals(decorator.getRealUrl()); } }