Skip to content

Commit af13fa4

Browse files
committed
fix(core/protocols): construction of x-amz-target header
1 parent 48ae272 commit af13fa4

File tree

8 files changed

+29
-10
lines changed

8 files changed

+29
-10
lines changed

packages/core/src/submodules/protocols/json/AwsJson1_0Protocol.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
2020
return "1.0" as const;
2121
}
2222

23+
/**
24+
* @override
25+
*/
2326
protected getDefaultContentType(): string {
24-
return "application/x-amz-json-1.1";
27+
return "application/x-amz-json-1.0";
2528
}
2629
}

packages/core/src/submodules/protocols/json/AwsJson1_1Protocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
2020
return "1.1" as const;
2121
}
2222

23+
/**
24+
* @override
25+
*/
2326
protected getDefaultContentType(): string {
2427
return "application/x-amz-json-1.1";
2528
}

packages/core/src/submodules/protocols/json/AwsRestJsonProtocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ export class AwsRestJsonProtocol extends HttpBindingProtocol {
158158
throw exception;
159159
}
160160

161+
/**
162+
* @override
163+
*/
161164
protected getDefaultContentType(): string {
162165
return "application/json";
163166
}

packages/core/src/submodules/protocols/query/AwsQueryProtocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ export class AwsQueryProtocol extends RpcProtocol {
213213
return errorData?.message ?? errorData?.Message ?? data.message ?? data.Message ?? "Unknown";
214214
}
215215

216+
/**
217+
* @override
218+
*/
216219
protected getDefaultContentType(): string {
217220
return "application/x-www-form-urlencoded";
218221
}

packages/core/src/submodules/protocols/xml/AwsRestXmlProtocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ export class AwsRestXmlProtocol extends HttpBindingProtocol {
173173
throw exception;
174174
}
175175

176+
/**
177+
* @override
178+
*/
176179
protected getDefaultContentType(): string {
177180
return "application/xml";
178181
}

private/aws-protocoltests-json-10-schema/src/runtimeConfig.shared.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => {
3131
},
3232
],
3333
logger: config?.logger ?? new NoOpLogger(),
34-
protocol: config?.protocol ?? new AwsJson1_0Protocol({ defaultNamespace: "aws.protocoltests.json10" }),
34+
protocol:
35+
config?.protocol ??
36+
new AwsJson1_0Protocol({ defaultNamespace: "aws.protocoltests.json10", serviceTarget: "JsonRpc10" }),
3537
serviceId: config?.serviceId ?? "JSON RPC 10",
3638
urlParser: config?.urlParser ?? parseUrl,
3739
utf8Decoder: config?.utf8Decoder ?? fromUtf8,

private/aws-protocoltests-json-schema/src/runtimeConfig.shared.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => {
3131
},
3232
],
3333
logger: config?.logger ?? new NoOpLogger(),
34-
protocol: config?.protocol ?? new AwsJson1_1Protocol({ defaultNamespace: "aws.protocoltests.json" }),
34+
protocol:
35+
config?.protocol ??
36+
new AwsJson1_1Protocol({ defaultNamespace: "aws.protocoltests.json", serviceTarget: "JsonProtocol" }),
3537
serviceId: config?.serviceId ?? "Json Protocol",
3638
urlParser: config?.urlParser ?? parseUrl,
3739
utf8Decoder: config?.utf8Decoder ?? fromUtf8,

private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,8 +2046,8 @@ export var TimestampFormatHeadersIO = struct(
20462046
);
20472047
export var TopLevel = struct(n0, _TLo, 0, [_di, _dLi, _dMi], [() => Dialog, () => DialogList, () => DialogMap]);
20482048
export var UnionInputOutput = struct(n0, _UIO, 0, [_con], [() => MyUnion]);
2049-
export var GreetingStruct = struct(n2, _GS, 0, [_sa], [0]);
2050-
export var GreetingStruct_n1 = struct(n1, _GS, 0, [_hi], [0]);
2049+
export var GreetingStruct_n2 = struct(n2, _GS, 0, [_sa], [0]);
2050+
export var GreetingStruct = struct(n1, _GS, 0, [_hi], [0]);
20512051
export var Unit = "unit" as const;
20522052

20532053
export var RestJsonProtocolServiceException = error(
@@ -2110,7 +2110,7 @@ export var DenseNumberMap = 128 | 1;
21102110
export var DenseSetMap = map(n0, _DSM, 0, 0, 64 | 0);
21112111
export var DenseStringMap = 128 | 0;
21122112

2113-
export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct_n1);
2113+
export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct);
21142114
export var DialogMap = map(n0, _DM, 0, 0, () => Dialog);
21152115
export var DocumentValuedMap = 128 | 15;
21162116

@@ -2150,7 +2150,7 @@ export var SparseStructMap = map(
21502150
[_sp]: 1,
21512151
},
21522152
0,
2153-
() => GreetingStruct_n1
2153+
() => GreetingStruct
21542154
);
21552155
export var TestStringMap = 128 | 0;
21562156

@@ -2175,7 +2175,7 @@ export var MyUnion = uni(
21752175
_MU,
21762176
0,
21772177
[_sV, _bVo, _nVu, _bVl, _tV, _eV, _lVi, _mV, _sVt, _rSV],
2178-
[0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct_n1, () => GreetingStruct]
2178+
[0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct, () => GreetingStruct_n2]
21792179
);
21802180
export var PlayerAction = uni(n0, _PA, 0, [_qu], [() => Unit]);
21812181
export var SimpleUnion = uni(n0, _SU, 0, [_int, _st], [1, 0]);
@@ -2570,7 +2570,7 @@ export var MalformedAcceptWithBody = op(
25702570
[_ht]: ["POST", "/MalformedAcceptWithBody", 200],
25712571
},
25722572
() => Unit,
2573-
() => GreetingStruct_n1
2573+
() => GreetingStruct
25742574
);
25752575
export var MalformedAcceptWithGenericString = op(
25762576
n0,
@@ -2623,7 +2623,7 @@ export var MalformedContentTypeWithBody = op(
26232623
{
26242624
[_ht]: ["POST", "/MalformedContentTypeWithBody", 200],
26252625
},
2626-
() => GreetingStruct_n1,
2626+
() => GreetingStruct,
26272627
() => Unit
26282628
);
26292629
export var MalformedContentTypeWithGenericString = op(

0 commit comments

Comments
 (0)