guzzle 7.9.2: simulate/mock a "502 Bad Gateway" ServerException

raw

code.php

1
2
3
4
5
6
7
8
if (mt_rand(0,20) >= 15) {
    throw new \GuzzleHttp\Exception\ServerException(
        '502 bad gateway test',
        new \GuzzleHttp\Psr7\Request('GET', 'http://example.org/'),
        new \GuzzleHttp\Psr7\Response(502),
    );
}
 
Christian Weiske Christian Weiske
owner

History