修复nacos请求参数问题
parent
c653ddf102
commit
ddaaf09f85
2
pom.xml
2
pom.xml
|
@ -27,6 +27,8 @@
|
|||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -12,5 +12,6 @@ import org.springframework.context.annotation.Import;
|
|||
NacosNamespaceInterceptor.class,
|
||||
NacosServerService.class
|
||||
})
|
||||
|
||||
public class NacosRemoteConfig {
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.muyu.common.nacos.remote;
|
|||
import com.dtflys.forest.annotation.BaseRequest;
|
||||
import com.dtflys.forest.annotation.Body;
|
||||
import com.dtflys.forest.annotation.GetRequest;
|
||||
import com.dtflys.forest.annotation.Query;
|
||||
import com.muyu.common.core.constant.Constants;
|
||||
import com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor;
|
||||
import com.muyu.common.nacos.remote.req.ServiceListReq;
|
||||
|
@ -20,5 +21,5 @@ public interface NacosServiceReomte {
|
|||
)
|
||||
|
||||
|
||||
public ServiceListResp serviceList(@Body ServiceListReq serviceListReq);
|
||||
public ServiceListResp serviceList(@Query ServiceListReq serviceListReq);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class NacosNamespaceInterceptor<T> implements Interceptor<T> {
|
|||
public boolean beforeExecute(ForestRequest req) {
|
||||
if(StringUtils.isNotEmpty(namespaceId)){
|
||||
// 执行在发送请求之前处理的代码
|
||||
Object reqNamespaceId = req.getQuery("namespaceId");
|
||||
Object reqNamespaceId =Convert.utf8Str( req.getQuery("namespaceId"));
|
||||
if(reqNamespaceId==null){
|
||||
log.warn("本次请求nacos的namespaceId未携带,已添加[{}]",namespaceId);
|
||||
req.addQuery("namespaceId", namespaceId); // 添加URL的Query参数
|
||||
|
|
|
@ -25,6 +25,7 @@ public class NacosServerService {
|
|||
.build()
|
||||
);
|
||||
serverList.addAll(serviceListResp.getDoms());
|
||||
|
||||
}while (serviceListResp.getCount() > pageNo*pageSize);
|
||||
|
||||
return serverList;
|
||||
|
|
Loading…
Reference in New Issue