diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-03-19 12:33:04 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-03-19 12:33:04 +0100 |
commit | bbdd0e0de0d24a962a6452d31dc26936bea1f958 (patch) | |
tree | 46fa7d2032e4b87f80ddd72bda444efc7944a99c | |
parent | b56a4a8f934f7ed9d3e7d19a4d3335738ca9ffad (diff) | |
download | zorglub-bbdd0e0de0d24a962a6452d31dc26936bea1f958.zip zorglub-bbdd0e0de0d24a962a6452d31dc26936bea1f958.tar.gz |
rack response.header -> response.headers
-rw-r--r-- | lib/zorglub/node.rb | 4 | ||||
-rw-r--r-- | spec/node_spec.rb | 24 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
3 files changed, 15 insertions, 15 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index d1a075a..793e81c 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -150,7 +150,7 @@ module Zorglub def redirect target, options={}, &block status = options[:status] || 302 body = options[:body] || redirect_body(target) - header = response.header.merge('Location' => target.to_s) + header = response.headers.merge('Location' => target.to_s) throw :stop_realize, Rack::Response.new(body, status, header, &block) end @@ -276,7 +276,7 @@ module Zorglub catch(:stop_realize) { feed! response.write @content - response.header['Content-Type'] ||= ( @mime || 'text/html' ) + response.headers['Content-Type'] ||= ( @mime || 'text/html' ) response.finish response } diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 62b9161..f77d7c3 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -158,17 +158,17 @@ describe Zorglub do it "default mime-type should be text/html" do r = Node0.my_call '/index' - expect(r.header['Content-type']).to eq 'text/html' + expect(r.headers['Content-type']).to eq 'text/html' end it "should be able to override mime-type" do r = Node0.my_call '/do_render' - expect(r.header['Content-type']).to eq 'text/view' + expect(r.headers['Content-type']).to eq 'text/view' end it "should be able to override through rack response mime-type" do r = Node0.my_call '/do_content_type' - expect(r.header['Content-type']).to eq 'text/mine' + expect(r.headers['Content-type']).to eq 'text/mine' end it "partial should render correctly" do @@ -198,30 +198,30 @@ describe Zorglub do it "static pages should be generated" do r = Node6.my_call '/do_static' expect(r.body[0]).to eq 'VAL 1' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' r = Node6.my_call '/do_static' expect(r.body[0]).to eq 'VAL 1' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' r = Node6.my_call '/do_static' expect(r.body[0]).to eq 'VAL 1' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' r = Node6.my_call '/no_static' expect(r.body[0]).to eq 'VAL 4' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' r = Node6.my_call '/do_static' expect(r.body[0]).to eq 'VAL 1' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' Node6.static! true, 0.000001 sleep 0.0001 r = Node6.my_call '/do_static' expect(r.body[0]).to eq 'VAL 6' - expect(r.header['Content-type']).to eq 'text/static' + expect(r.headers['Content-type']).to eq 'text/static' end it "redirect should work" do r = Node0.my_call '/do_redirect' expect(r.status).to eq 302 - expect(r.header['location']).to eq Node0.r(:do_partial,1,2,3) + expect(r.headers['location']).to eq Node0.r(:do_partial,1,2,3) end it "no_layout! should be inherited" do @@ -256,10 +256,10 @@ describe Zorglub do it "ext definition and file engine should work" do r = Node0.my_call '/xml_file' expect(r.body[0]).to eq "<xml>file<\/xml>\n" - expect(r.header['Content-type']).to eq 'application/xml' + expect(r.headers['Content-type']).to eq 'application/xml' r = Node0.my_call '/plain_file' expect(r.body[0]).to eq "plain file\n" - expect(r.header['Content-type']).to eq 'text/plain' + expect(r.headers['Content-type']).to eq 'text/plain' end it "no view no layout should work as well" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 40fb924..9b2c452 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -68,7 +68,7 @@ class Node0 < Zorglub::Node end def do_content_type engine! 'real' - response.header['Content-Type'] = 'text/mine' + response.headers['Content-Type'] = 'text/mine' end def do_partial a1, a2 engine! 'real' |