response_headers

检查 HTTP 响应头的值。

语法

--- response_headers 段检查响应中的特定头部字段,每行一个,格式为 Header-Name: expected-value

perl
1=== TEST 1: check headers
2--- config
3 location /t {
4 add_header X-Custom "test-value";
5 return 200 "ok";
6 }
7--- request
8GET /t
9--- response_headers
10X-Custom: test-value
11Content-Type: text/plain