Sha256: 894e24ee238c8ac8d9f8eaa7b06b379fe5c787a7653a641d2a6bdc1b6f4282cc
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
# WebROaR - Ruby Application Server - http://webroar.in/ # Copyright (C) 2009 Goonj LLC # # This file is part of WebROaR. # # WebROaR is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # WebROaR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with WebROaR. If not, see <http://www.gnu.org/licenses/>. require 'spec_helper' require 'zlib' describe 'Content-Encoding' do it_should_behave_like "Server Setup" it_should_behave_like "Connection Setup" it "should return gzip encoded content when said" do request = "GET /test_app/test/content_encoding HTTP/1.1\r\nHost: localhost\r\nAccept-Encoding: gzip\r\n\r\n" @conn.write request status, headers, body = parse_response @conn.read io = StringIO.new(body) gzip = Zlib::GzipReader.new(io) gzip.read.should =~ /ok/ gzip.close end it "should return deflate encoded content when said" do request = "GET /test_app/test/content_encoding HTTP/1.1\r\nHost: localhost\r\nAccept-Encoding: deflate\r\n\r\n" @conn.write request status, headers, body = parse_response @conn.read inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) inflater.inflate(body).should =~ /ok/ inflater.close end it "should return plain text when said encoding not supporting" do request = "GET /test_app/test/content_encoding HTTP/1.1\r\nHost: localhost\r\nAccept-Encoding: xyz\r\n\r\n" @conn.write request status, headers, body = parse_response @conn.read body.should =~ /ok/ end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webroar-0.2.5 | test/spec/content_encoding_spec.rb |
webroar-0.2.4 | test/spec/content_encoding_spec.rb |
webroar-0.2.3 | test/spec/content_encoding_spec.rb |