[ISSUE #563] fix pr #606 cause ci fail (#613)

pull/618/head
liaochuntao 2 years ago committed by GitHub
parent 6a6970702b
commit e06a0184d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,3 +7,4 @@
- [Optimize: optimize configuration conditional & optimize config data tips](https://github.com/Tencent/spring-cloud-tencent/pull/603)
- [Automatically transmit some headers specified by a environment varaible that directly defines header keys.](https://github.com/Tencent/spring-cloud-tencent/pull/606)
- [Optimize: Maybe remove Chinese characters](https://github.com/Tencent/spring-cloud-tencent/pull/607)
- [ fix pr #606 cause ci fail](https://github.com/Tencent/spring-cloud-tencent/pull/613)

@ -104,7 +104,7 @@ public class DecodeTransferMetadataReactiveFilter implements WebFilter, Ordered
.getFragmentContext(FRAGMENT_RAW_TRANSHEADERS);
if (!CollectionUtils.isEmpty(transHeaderMetadata)) {
Optional<String> transHeaders = transHeaderMetadata.keySet().stream().findFirst();
String[] transHeaderArray = transHeaders.get().split(";");
String[] transHeaderArray = transHeaders.get().split(",");
HttpHeaders headers = serverHttpRequest.getHeaders();
Set<String> headerKeys = headers.keySet();
Iterator<String> iterator = headerKeys.iterator();

@ -91,7 +91,7 @@ public class DecodeTransferMetadataServletFilter extends OncePerRequestFilter {
.getFragmentContext(FRAGMENT_RAW_TRANSHEADERS);
if (!CollectionUtils.isEmpty(transHeaderMetadata)) {
Optional<String> transHeaders = transHeaderMetadata.keySet().stream().findFirst();
String[] transHeaderArray = transHeaders.get().split(";");
String[] transHeaderArray = transHeaders.get().split(",");
Enumeration<String> httpHeaders = httpServletRequest.getHeaderNames();
while (httpHeaders.hasMoreElements()) {
String httpHeader = httpHeaders.nextElement();

@ -102,7 +102,7 @@ public class EncodeTransferMedataScgFilter implements GlobalFilter, Ordered {
.getFragmentContext(FRAGMENT_RAW_TRANSHEADERS);
if (!CollectionUtils.isEmpty(transHeaderMetadata)) {
Optional<String> transHeaders = transHeaderMetadata.keySet().stream().findFirst();
String[] transHeaderArray = transHeaders.get().split(";");
String[] transHeaderArray = transHeaders.get().split(",");
HttpHeaders headers = serverHttpRequest.getHeaders();
Set<String> headerKeys = headers.keySet();
Iterator<String> iterator = headerKeys.iterator();

@ -26,6 +26,7 @@ import com.tencent.cloud.common.metadata.config.MetadataLocalProperties;
import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import static com.tencent.cloud.common.metadata.MetadataContext.FRAGMENT_DISPOSABLE;
import static com.tencent.cloud.common.metadata.MetadataContext.FRAGMENT_RAW_TRANSHEADERS;
@ -68,7 +69,10 @@ public final class MetadataContextHolder {
MetadataContext metadataContext = new MetadataContext();
metadataContext.putFragmentContext(FRAGMENT_TRANSITIVE, staticMetadataManager.getMergedStaticTransitiveMetadata());
metadataContext.putFragmentContext(FRAGMENT_DISPOSABLE, staticMetadataManager.getMergedStaticDisposableMetadata());
metadataContext.putContext(FRAGMENT_RAW_TRANSHEADERS, staticMetadataManager.getEnvTransHeaderMetadata(), "");
if (StringUtils.hasText(staticMetadataManager.getTransHeaderFromEnv())) {
metadataContext.putContext(FRAGMENT_RAW_TRANSHEADERS, staticMetadataManager.getTransHeaderFromEnv(), "");
}
METADATA_CONTEXT.set(metadataContext);

@ -60,7 +60,7 @@ public class StaticMetadataManager {
* The value mapped by this key was specified by user.
* This is configured in environment variables.
*/
private static final String ENV_METADATA_CONTENT_RAW_TRANSHEADERS = "SCT_METADATA_CONTENT_RAW_TRANSHEADERS";
private static final String ENV_TRAFFIC_CONTENT_RAW_TRANSHEADERS = "SCT_TRAFFIC_CONTENT_RAW_TRANSHEADERS";
private static final String ENV_METADATA_ZONE = "SCT_METADATA_ZONE";
private static final String ENV_METADATA_REGION = "SCT_METADATA_REGION";
private static final String ENV_METADATA_CAMPUS = "SCT_METADATA_CAMPUS";
@ -107,7 +107,7 @@ public class StaticMetadataManager {
if (StringUtils.isNotBlank(key) && key.startsWith(ENV_METADATA_PREFIX)
&& !key.equals(ENV_METADATA_CONTENT_TRANSITIVE)) {
String sourceKey = "";
if (key.equals(ENV_METADATA_CONTENT_RAW_TRANSHEADERS)) {
if (key.equals(ENV_TRAFFIC_CONTENT_RAW_TRANSHEADERS)) {
sourceKey = key;
}
else {
@ -282,8 +282,8 @@ public class StaticMetadataManager {
return envMetadata;
}
public String getEnvTransHeaderMetadata() {
return envMetadata.get(ENV_METADATA_CONTENT_RAW_TRANSHEADERS);
public String getTransHeaderFromEnv() {
return envMetadata.get(ENV_TRAFFIC_CONTENT_RAW_TRANSHEADERS);
}
public Map<String, String> getEnvTransitiveMetadata() {

Loading…
Cancel
Save