Skip to content

Commit 210b7c1

Browse files
committed
feat: add @JsonProperty annotations for ApsaraGatewayConfig and pass regionId header
- Add @JsonProperty annotations to xAcs* fields in ApsaraGatewayConfig to ensure correct JSON serialization/deserialization - Add x-acs-regionId header in ApsaraGatewayClient when regionId is configured
1 parent 279c38a commit 210b7c1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

himarket-dal/src/main/java/com/alibaba/himarket/support/gateway/ApsaraGatewayConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import cn.hutool.core.util.StrUtil;
2323
import com.alibaba.himarket.support.common.Encrypted;
24+
import com.fasterxml.jackson.annotation.JsonProperty;
2425
import lombok.Data;
2526

2627
@Data
@@ -42,11 +43,19 @@ public class ApsaraGatewayConfig {
4243
private String version;
4344

4445
/** 业务头 */
46+
@JsonProperty("xAcsOrganizationId")
4547
private String xAcsOrganizationId;
4648

49+
@JsonProperty("xAcsCallerSdkSource")
4750
private String xAcsCallerSdkSource;
51+
52+
@JsonProperty("xAcsResourceGroupId")
4853
private String xAcsResourceGroupId;
54+
55+
@JsonProperty("xAcsCallerType")
4956
private String xAcsCallerType;
57+
58+
@JsonProperty("xAcsRoleId")
5059
private String xAcsRoleId;
5160

5261
public String buildUniqueKey() {

himarket-server/src/main/java/com/alibaba/himarket/service/gateway/client/ApsaraGatewayClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ public <E> E execute(
464464

465465
Map<String, String> headers = new HashMap<>();
466466
headers.put("Accept", "application/json");
467+
if (config.getRegionId() != null) {
468+
headers.put("x-acs-regionId", config.getRegionId());
469+
}
467470
if (config.getXAcsCallerSdkSource() != null) {
468471
headers.put("x-acs-caller-sdk-source", config.getXAcsCallerSdkSource());
469472
}

0 commit comments

Comments
 (0)