Skip to content

Commit

Permalink
fix(sqs): set httpRequest.params in queryCompatibility mode in JSON p…
Browse files Browse the repository at this point in the history
…rotocol (#4405)
  • Loading branch information
kuhe authored Apr 28, 2023
1 parent 53d23eb commit 543052d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-SQS-e1c1ffea.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "SQS",
"description": "add queryCompatibility fix to JSON protocol"
}
9 changes: 9 additions & 0 deletions lib/protocol/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ function buildRequest(req) {
var builder = new JsonBuilder();

if (version === 1) version = '1.0';

if (api.awsQueryCompatible) {
if (!httpRequest.params) {
httpRequest.params = {};
}
// because Query protocol does this.
Object.assign(httpRequest.params, req.params);
}

httpRequest.body = builder.build(req.params || {}, input);
httpRequest.headers['Content-Type'] = 'application/x-amz-json-' + version;
httpRequest.headers['X-Amz-Target'] = target;
Expand Down
5 changes: 2 additions & 3 deletions lib/services/sqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AWS.util.update(AWS.SQS.prototype, {
* @api private
*/
setupRequestListeners: function setupRequestListeners(request) {
request.addListener('build', this.buildEndpoint.bind(this));
request.addListener('build', this.buildEndpoint);

if (request.service.config.computeChecksums) {
if (request.operation === 'sendMessage') {
Expand Down Expand Up @@ -118,8 +118,7 @@ AWS.util.update(AWS.SQS.prototype, {
* @api private
*/
buildEndpoint: function buildEndpoint(request) {
var params = request.httpRequest.params || this.config.params;
var url = params.QueueUrl;
var url = request.httpRequest.params.QueueUrl;
if (url) {
request.httpRequest.endpoint = new AWS.Endpoint(url);

Expand Down

0 comments on commit 543052d

Please sign in to comment.