File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/legalesign_sdk/internal
test/legalesign_sdk/internal Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -566,7 +566,8 @@ class << self
566566 #
567567 # @return [Array(String, Enumerable<String>)]
568568 private def encode_multipart_streaming ( body )
569- boundary = SecureRandom . urlsafe_base64 ( 60 )
569+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570+ boundary = SecureRandom . urlsafe_base64 ( 46 )
570571
571572 closing = [ ]
572573 strio = writable_enum do |y |
Original file line number Diff line number Diff line change @@ -213,6 +213,18 @@ def env_table
213213 end
214214 end
215215
216+ def test_encoding_length
217+ headers , = LegalesignSDK ::Internal ::Util . encode_content (
218+ { "content-type" => "multipart/form-data" } ,
219+ Pathname ( __FILE__ )
220+ )
221+ assert_pattern do
222+ headers . fetch ( "content-type" ) => /boundary=(.+)$/
223+ end
224+ field , = Regexp . last_match . captures
225+ assert ( field . length < 70 - 6 )
226+ end
227+
216228 def test_file_encode
217229 file = Pathname ( __FILE__ )
218230 headers = { "content-type" => "multipart/form-data" }
You can’t perform that action at this time.
0 commit comments