Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/http/charsets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
expect(charsets[1].charset).to be == "iso-8859-1"
expect(charsets[2].charset).to be == "windows-1252"
end

it "should accept empty string" do
expect(HTTP::Accept::Charsets.parse("")).to be == []
end

it "should not accept invalid input" do
[
Expand All @@ -60,6 +64,10 @@
expect{HTTP::Accept::Charsets.parse(text)}.to raise_exception(HTTP::Accept::ParseError)
end
end

it "should not accept nil input" do
expect{HTTP::Accept::Charsets.parse(nil)}.to raise_exception(TypeError)
end

describe "browser_preferred_charsets" do
it "should parse a non-blank header" do
Expand Down
8 changes: 8 additions & 0 deletions test/http/encodings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
expect(encodings[2].encoding).to be == "deflate"
end

it "should accept empty string" do
expect(HTTP::Accept::Encodings.parse("")).to be == []
end

it "should not accept invalid input" do
[
"gzip;f=1", "br;gzip",
Expand All @@ -60,6 +64,10 @@
expect{HTTP::Accept::Encodings.parse(text)}.to raise_exception(HTTP::Accept::ParseError)
end
end

it "should not accept nil input" do
expect{HTTP::Accept::Encodings.parse(nil)}.to raise_exception(TypeError)
end

describe "browser_preferred_content_codings" do
it "should parse a non-blank header" do
Expand Down
8 changes: 8 additions & 0 deletions test/http/media_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
expect(media_types[0].mime_type).to be == "foo/bar"
expect(media_types[0].parameters).to be == {'key' => "A,B,C"}
end

it "should accept empty string" do
expect(HTTP::Accept::MediaTypes.parse("")).to be == []
end

it "should not accept invalid input" do
[
Expand All @@ -50,6 +54,10 @@
expect{HTTP::Accept::MediaTypes.parse(text)}.to raise_exception(HTTP::Accept::ParseError)
end
end

it "should not accept nil input" do
expect{HTTP::Accept::MediaTypes.parse(nil)}.to raise_exception(TypeError)
end
end

AMediaTypeSelector = Sus::Shared("a media type selector") do |header_value, priorities = nil|
Expand Down
Loading