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