Skip to content

Commit

Permalink
Add test for #210 report
Browse files Browse the repository at this point in the history
  • Loading branch information
MATSUMOTO Ryosuke committed Sep 28, 2016
1 parent adffb4b commit 67403f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,14 @@ http {
location /nginx_false_true {
mruby_content_handler_code 'Nginx.rputs (Nginx::FALSE + Nginx::TRUE)';
}
location /issue_210 {
mruby_post_read_handler_code 'Nginx::Request.new.headers_out["hoge"] = "fuga"';
mruby_content_handler_code 'Nginx.rputs "hello"';
}
location /issue_210_2 {
mruby_post_read_handler build/nginx/html/issue-210.rb cache;
mruby_content_handler_code 'Nginx.rputs "hello2"';
}
}

server {
Expand Down
1 change: 1 addition & 0 deletions test/html/issue-210.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Nginx::Request.new.headers_out["fuga"] = "hoge"
12 changes: 12 additions & 0 deletions test/t/ngx_mruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,18 @@ def base_ssl(port)
t.assert_equal "false", res["body"]
end

t.assert('ngx_mruby - bug; mruby_post_read_handler not running in 1.18.3+', 'location /issue_210') do
res = HttpRequest.new.get base + '/issue_210'
t.assert_equal "fuga", res["hoge"]
t.assert_equal "hello", res["body"]
end

t.assert('ngx_mruby - bug; mruby_post_read_handler not running in 1.18.3+ for file code', 'location /issue_210_2') do
res = HttpRequest.new.get base + '/issue_210_2'
t.assert_equal "hoge", res["fuga"]
t.assert_equal "hello2", res["body"]
end

p nginx_version

if nginx_version.split(".")[1].to_i > 6
Expand Down

0 comments on commit 67403f3

Please sign in to comment.