mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(http): stop retrying requests that timed out after they were sent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
597a878d80
commit
fd5efd0273
@@ -38,3 +38,20 @@ test('a post request is not retried because the server can have received it', fu
|
||||
expect(fn () => Http::post('https://api.example.com/items'))->toThrow(ConnectionException::class)
|
||||
->and($this->attempts)->toBe(1);
|
||||
});
|
||||
|
||||
test('a read request is not sent again after it timed out waiting for the response', function () {
|
||||
$server = stream_socket_server('tcp://127.0.0.1:0');
|
||||
$address = stream_socket_get_name($server, false);
|
||||
|
||||
expect(fn () => Http::timeout(1)->get("http://{$address}/slow"))
|
||||
->toThrow(ConnectionException::class, 'cURL error 28');
|
||||
|
||||
stream_set_blocking($server, false);
|
||||
$connections = 0;
|
||||
while (@stream_socket_accept($server, 0)) {
|
||||
$connections++;
|
||||
}
|
||||
fclose($server);
|
||||
|
||||
expect($connections)->toBe(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user