Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/submodules/protocols/ProtocolLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class ProtocolLib {
} else if (!inputSchema.isUnitSchema()) {
const hasBody = Object.values(members).find((m) => {
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m.getMergedTraits();
return !httpQuery && !httpQueryParams && !httpHeader && !httpLabel && httpPrefixHeaders === void 0;
const noPrefixHeaders = httpPrefixHeaders === void 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this variable because the previous expression was potentially confusing as to the order of operations of && and ===.

return !httpQuery && !httpQueryParams && !httpHeader && !httpLabel && noPrefixHeaders;
});
if (hasBody) {
return defaultContentType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class AwsQueryProtocol extends RpcProtocol {
if (deref(operationSchema.input) === "unit" || !request.body) {
request.body = "";
}
request.body = `Action=${operationSchema.name.split("#")[1]}&Version=${this.options.version}` + request.body;
const action = operationSchema.name.split("#")[1] ?? operationSchema.name;
request.body = `Action=${action}&Version=${this.options.version}` + request.body;
if (request.body.endsWith("&")) {
request.body = request.body.slice(-1);
}
Expand Down Expand Up @@ -110,9 +111,8 @@ export class AwsQueryProtocol extends RpcProtocol {
delete response.headers[header];
response.headers[header.toLowerCase()] = value;
}

const awsQueryResultKey =
ns.isStructSchema() && this.useNestedResult() ? operationSchema.name.split("#")[1] + "Result" : undefined;
const shortName = operationSchema.name.split("#")[1] ?? operationSchema.name;
const awsQueryResultKey = ns.isStructSchema() && this.useNestedResult() ? shortName + "Result" : undefined;
const bytes: Uint8Array = await collectBody(response.body, context as SerdeFunctions);
if (bytes.byteLength > 0) {
Object.assign(dataObject, await deserializer.read(ns, bytes, awsQueryResultKey));
Expand Down
Loading