File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
utils/test-helper-utils/src Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,24 @@ export function pdfLetterMultipart(
2424} {
2525 const fd = new FormData ( ) ;
2626 for ( const part of parts ) {
27- if ( part . _type === 'json' ) {
28- fd . append (
29- part . partName ,
30- typeof template === 'string' ? template : JSON . stringify ( template )
31- ) ;
32- }
33-
34- if ( part . _type === 'file' ) {
35- fd . append ( part . partName , part . file , {
36- filename : part . fileName ,
37- contentType : part . fileType ,
38- } ) ;
27+ switch ( part . _type ) {
28+ case 'json' : {
29+ fd . append (
30+ part . partName ,
31+ typeof template === 'string' ? template : JSON . stringify ( template )
32+ ) ;
33+ break ;
34+ }
35+ case 'file' : {
36+ fd . append ( part . partName , part . file , {
37+ filename : part . fileName ,
38+ contentType : part . fileType ,
39+ } ) ;
40+ break ;
41+ }
42+ default : {
43+ throw new Error ( `unknown part type ${ part } ` ) ;
44+ }
3945 }
4046 }
4147
You can’t perform that action at this time.
0 commit comments