|
|
@ -21,7 +21,7 @@ import static com.gitee.sop.gatewaycommon.gateway.filter.Orders.PARAMETER_FORMAT |
|
|
|
public class ParameterFormatterFilter implements GlobalFilter, Ordered { |
|
|
|
public class ParameterFormatterFilter implements GlobalFilter, Ordered { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false) |
|
|
|
@Autowired(required = false) |
|
|
|
private ParameterFormatter sopParameterFormatter; |
|
|
|
private ParameterFormatter parameterFormatter; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
|
|
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
|
|
@ -30,11 +30,11 @@ public class ParameterFormatterFilter implements GlobalFilter, Ordered { |
|
|
|
return chain.filter(exchange); |
|
|
|
return chain.filter(exchange); |
|
|
|
} |
|
|
|
} |
|
|
|
// 校验成功后进行参数转换
|
|
|
|
// 校验成功后进行参数转换
|
|
|
|
if (sopParameterFormatter != null) { |
|
|
|
if (parameterFormatter != null) { |
|
|
|
ServerWebExchange formatExchange = ServerWebExchangeUtil.format( |
|
|
|
ServerWebExchange formatExchange = ServerWebExchangeUtil.format( |
|
|
|
exchange |
|
|
|
exchange |
|
|
|
, apiParam |
|
|
|
, apiParam |
|
|
|
, sopParameterFormatter::format |
|
|
|
, parameterFormatter::format |
|
|
|
, httpHeaders -> httpHeaders.set(ParamNames.HEADER_VERSION_NAME, apiParam.fetchVersion())); |
|
|
|
, httpHeaders -> httpHeaders.set(ParamNames.HEADER_VERSION_NAME, apiParam.fetchVersion())); |
|
|
|
return chain.filter(formatExchange); |
|
|
|
return chain.filter(formatExchange); |
|
|
|
} |
|
|
|
} |
|
|
|