Mercurial > hg > nginx-tests
changeset 923:9239393e73c8
Tests: added X-Accel-Redirect test for request method name change.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 12 May 2016 14:07:10 +0300 |
parents | 93d900bac201 |
children | 54680c434afa |
files | proxy_xar.t |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy_xar.t Thu May 12 13:08:43 2016 +0300 +++ b/proxy_xar.t Thu May 12 14:07:10 2016 +0300 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(15); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(16); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -42,7 +42,8 @@ # catch safe and unhandled unsafe URIs, # bypassed with redirect to named location if ($upstream_http_x_accel_redirect) { - return 200 "xar: $upstream_http_x_accel_redirect uri: $uri"; + return 200 "xar: $upstream_http_x_accel_redirect uri: $uri + method: $request_method"; } location /proxy { @@ -88,6 +89,9 @@ like($r, qr/^Accept-Ranges: parrots/m, 'Accept-Ranges preserved'); unlike($r, qr/^Something/m, 'other headers stripped'); +like(http_post('/proxy?xar=/index.html'), qr/method: GET/, + 'X-Accel-Redirect method name'); + # escaped characters like(http_get('/proxy?xar=/foo?bar'), qr/200 OK.*xar: \/foo\?bar/s, @@ -107,3 +111,14 @@ qr!200 OK.*named xar: \@named uri: /proxy!s, 'in named location'); ############################################################################### + +sub http_post { + my ($url) = @_; + http(<<EOF); +POST $url HTTP/1.0 +Host: localhost + +EOF +} + +###############################################################################