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

revision 1d1cb28843f78995f1ff4e2cba8eddebce00d542

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),
    );
}
 

History