import { RequestNode , UploadableMap , Variables } from 'relay-runtime' ; const getRequestBodyWithUploadables = ( request , variables , uploadables ) => { const formData = new FormData ( ) ; formData . append ( 'query' , request . text ) ; formData . append ( 'variables' , JSON . stringify ( variables ) ) ; Object . keys ( uploadables ) . forEach ( ( key ) => { formData . append ( key , uploadables [ key ] ) ; } ) ; return formData ; } ; const getRequestBodyWithoutUplodables = ( request , variables ) : string => { return JSON . stringify ( { variables , query : request . text , } ) ; } ; const getRequestBody = ( request , variables , uploadables ? ) : FormData | string => { if ( uploadables ) { return getRequestBodyWithUploadables ( request , variables , uploadables ) ; } return getRequestBodyWithoutUplodables ( request , variables ) ; } ; export default getRequestBody ;