Skip to content

Loading…

#129: Support for few values for one key #130

Closed
wants to merge 1 commit into from

2 participants

@edtsech

Add ability to do smth like this PDFKit.new('http://example.com', cookie: ["name", "value"])
For multivalues attributes like ---cookie or --custom-header for example.
Patch for #129.

This was referenced
@sigmavirus24
pdfkit member

Does this patch fix this? 3e836ab#L0L133 I think it might and in fact also handles a few more edge cases. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 2, 2012
  1. @edtsech
Showing with 8 additions and 0 deletions.
  1. +2 −0 lib/pdfkit/pdfkit.rb
  2. +6 −0 spec/pdfkit_spec.rb
View
2 lib/pdfkit/pdfkit.rb
@@ -129,6 +129,8 @@ def normalize_value(value)
case value
when TrueClass
nil
+ when Array
+ value
else
value.to_s
end
View
6 spec/pdfkit_spec.rb
@@ -134,6 +134,12 @@
pdfkit = PDFKit.new(body)
pdfkit.command[pdfkit.command.index('"--orientation"') + 1].should == '"Landscape"'
end
+
+ it "should support few values for one key" do
+ pdfkit = PDFKit.new('html', cookie: ['name', 'value'])
+ pdfkit.command.should include("\"name\"")
+ pdfkit.command.should include("\"value\"")
+ end
end
Something went wrong with that request. Please try again.