Skip to content

Commit

Permalink
Add tests to HTTP::Accept::Encodings with nil and empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisbernard authored and ioquatix committed Mar 9, 2025
1 parent 4eb0353 commit 9205211
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 9205211

Please sign in to comment.