ignore_response

完全跳过对响应状态码和响应体的检查。

语法

--- ignore_response 段告诉框架不要检查响应的状态码和响应体。常用于测试错误场景,此时你只关心错误日志而非响应本身。

perl
1=== TEST 1: only check error log
2--- config
3 location /t {
4 proxy_pass http://127.0.0.1:62345;
5 }
6--- request
7GET /t
8--- ignore_response
9--- error_log
10connect() failed

当上游服务返回非法响应或连接失败时,使用 ignore_response 配合 error_log 断言是最可靠的方式。