@@ -597,21 +597,32 @@ export function getResolver<TSource, TContext, TArgs> ({
597597 let data
598598 // tslint:disable-next-line:no-conditional-assignment
599599 while ( data = this . read ( ) ) {
600- filePassThrough . write ( data )
600+ const canReadNext = filePassThrough . write ( data )
601+ if ( ! canReadNext ) {
602+ this . pause ( )
603+ filePassThrough . once ( 'drain' , ( ) => this . resume ( ) )
604+ }
601605 }
602606 } )
603607
608+ originalFileStream . on ( 'error' , ( ) => {
609+ uploadLog ( 'Encountered an error while uploading the file %s' , uploadingFile . filename )
610+ } )
611+
604612 originalFileStream . on ( 'end' , ( ) => {
605- uploadLog ( ` Upload for received file ${ uploadingFile . filename } completed` )
613+ uploadLog ( ' Upload for received file %s completed' , uploadingFile . filename )
606614 filePassThrough . end ( )
607615 } )
608616
609- uploadLog ( ` Queuing upload for received file ${ uploadingFile . filename } ` )
617+ uploadLog ( ' Queuing upload for received file %s' , uploadingFile . filename )
610618
611619 form . append ( fieldName , filePassThrough , {
612620 filename : uploadingFile . filename ,
613621 contentType : uploadingFile . mimetype
614622 } )
623+ } else if ( typeof fieldValue !== 'string' ) {
624+ // handle all other primitives that aren't strings as strings the way the web server would expect it
625+ form . append ( fieldName , JSON . stringify ( fieldValue ) )
615626 } else {
616627 form . append ( fieldName , fieldValue )
617628 }
0 commit comments