Sha256: b93d42c8b55588e2924eb56ba1f100ee2ca37dd808299fd2bee79f7f9946e1dd

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 KB

Contents

require "spec_helper"

describe Invoker::Power::HttpParser do
  let(:parser) { Invoker::Power::HttpParser.new('https') }

  describe "complete message received" do
    before { parser.reset }
    it "should call header received with full header" do
      @header = nil
      parser.on_headers_complete { |header| @header = header }
      parser << "HTTP/1.1 200 OK\r\n"
      parser << "Content-Type: text/plain;charset=utf-8\r\n"
      parser << "Content-Length: 5\r\n"
      parser << "Connection: close\r\n\r\n"
      parser << "hello"

      expect(@header['Content-Type']).to eql "text/plain;charset=utf-8"
    end

    it "should return complete message with x_forwarded added" do
      complete_message = nil
      parser.on_message_complete { |message| complete_message = message }
      parser.on_headers_complete { |header| @header = header }
      parser << "HTTP/1.1 200 OK\r\n"
      parser << "Content-Type: text/plain;charset=utf-8\r\n"
      parser << "Content-Length: 5\r\n"
      parser << "Connection: close\r\n\r\n"
      parser << "hello"
      expect(complete_message).to match(/X_FORWARDED_PROTO:/i)
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
itrg-invoker-1.6.1 spec/invoker/power/http_parser_spec.rb
itrg-invoker-1.6.0 spec/invoker/power/http_parser_spec.rb
invoker-1.5.8 spec/invoker/power/http_parser_spec.rb
invoker-1.5.7 spec/invoker/power/http_parser_spec.rb
invoker-1.5.6 spec/invoker/power/http_parser_spec.rb
invoker-1.5.5 spec/invoker/power/http_parser_spec.rb
invoker-1.5.4 spec/invoker/power/http_parser_spec.rb
invoker-1.5.3 spec/invoker/power/http_parser_spec.rb
meepo-1.5.2 spec/invoker/power/http_parser_spec.rb
invoker-1.5.1 spec/invoker/power/http_parser_spec.rb
invoker-1.4.1 spec/invoker/power/http_parser_spec.rb
invoker-1.4.0 spec/invoker/power/http_parser_spec.rb
invoker-1.3.2 spec/invoker/power/http_parser_spec.rb
invoker-1.3.1 spec/invoker/power/http_parser_spec.rb
invoker-1.3.0 spec/invoker/power/http_parser_spec.rb
invoker-1.2.0 spec/invoker/power/http_parser_spec.rb
invoker-1.2.0.pre2 spec/invoker/power/http_parser_spec.rb