Skip to content

Commit

Permalink
bugfix: remove queueurl middleware (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
stobrien89 authored Nov 14, 2023
1 parent f3276ec commit 7148ad1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
7 changes: 7 additions & 0 deletions .changes/nextrelease/remove-sqs-middleware.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "bugfix",
"category": "Sqs",
"description": "Moves queue url middleware, which is no longer needed after the SQS migration from query to json protocol."
}
]
24 changes: 0 additions & 24 deletions src/Sqs/SqsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function __construct(array $config)
{
parent::__construct($config);
$list = $this->getHandlerList();
$list->appendBuild($this->queueUrl(), 'sqs.queue_url');
$list->appendSign($this->validateMd5(), 'sqs.md5');
}

Expand Down Expand Up @@ -93,29 +92,6 @@ public function getQueueArn($queueUrl)
return $queueArn;
}

/**
* Moves the URI of the queue to the URI in the input parameter.
*
* @return callable
*/
private function queueUrl()
{
return static function (callable $handler) {
return function (
CommandInterface $c,
RequestInterface $r = null
) use ($handler) {
if ($c->hasParam('QueueUrl')) {
$r = $r->withUri(UriResolver::resolve(
$r->getUri(),
new Uri($c['QueueUrl'])
));
}
return $handler($c, $r);
};
};
}

/**
* Calculates the expected md5 hash of message attributes according to the encoding
* scheme detailed in SQS documentation.
Expand Down
15 changes: 0 additions & 15 deletions tests/Sqs/SqsClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,4 @@ public function testSkipsCommandsThatAreNotReceiveMessage()
$this->addMockResults($client, [new Result()]);
$client->listQueues();
}

public function testUpdatesQueueUrl()
{
// Setup state of command/request
$newUrl = 'https://queue.amazonaws.com/stuff/in/the/path';
$client = new SqsClient([
'region' => 'us-east-1',
'version' => 'latest'
]);
$this->addMockResults($client, [[]]);
$client->getHandlerList()->appendSign(Middleware::tap(function ($c, $r) use ($newUrl) {
$this->assertSame($newUrl, (string)$r->getUri());
}));
$client->receiveMessage(['QueueUrl' => $newUrl]);
}
}

0 comments on commit 7148ad1

Please sign in to comment.