@@ -364,4 +364,28 @@ describe("Multipart", function () {
364364 expect ( ( ) => new Multipart ( [ ] , "foo?bar" ) . bytes ( ) ) . to . not . throw ( ) ;
365365 } ) ;
366366 } ) ;
367+
368+ describe ( "#headers" , function ( ) {
369+ it ( "should have the Content-Type boundary parameters in quotes as per RFC 2616" , function ( ) {
370+ expect ( new Multipart ( [ ] , "foobar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( "multipart/mixed; boundary=foobar" ) ;
371+ expect ( new Multipart ( [ ] , "foo\tbar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo\tbar"' ) ;
372+ expect ( new Multipart ( [ ] , "foo bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo bar"' ) ;
373+ expect ( new Multipart ( [ ] , 'foo"bar' , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo\\"bar"' ) ;
374+ expect ( new Multipart ( [ ] , "foo(bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo(bar"' ) ;
375+ expect ( new Multipart ( [ ] , "foo)bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo)bar"' ) ;
376+ expect ( new Multipart ( [ ] , "foo,bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo,bar"' ) ;
377+ expect ( new Multipart ( [ ] , "foo:bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo:bar"' ) ;
378+ expect ( new Multipart ( [ ] , "foo;bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo;bar"' ) ;
379+ expect ( new Multipart ( [ ] , "foo<bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo<bar"' ) ;
380+ expect ( new Multipart ( [ ] , "foo=bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo=bar"' ) ;
381+ expect ( new Multipart ( [ ] , "foo>bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo>bar"' ) ;
382+ expect ( new Multipart ( [ ] , "foo?bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo?bar"' ) ;
383+ expect ( new Multipart ( [ ] , "foo@bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo@bar"' ) ;
384+ expect ( new Multipart ( [ ] , "foo[bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo[bar"' ) ;
385+ expect ( new Multipart ( [ ] , "foo\\bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo\\bar"' ) ;
386+ expect ( new Multipart ( [ ] , "foo]bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo]bar"' ) ;
387+ expect ( new Multipart ( [ ] , "foo{bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo{bar"' ) ;
388+ expect ( new Multipart ( [ ] , "foo}bar" , "multipart/mixed" ) . headers . get ( "content-type" ) ) . to . equal ( 'multipart/mixed; boundary="foo}bar"' ) ;
389+ } ) ;
390+ } ) ;
367391} ) ;
0 commit comments