diff --git a/ReactNativeClient/lib/shim-init-node.js b/ReactNativeClient/lib/shim-init-node.js index b73336cdc..04861d594 100644 --- a/ReactNativeClient/lib/shim-init-node.js +++ b/ReactNativeClient/lib/shim-init-node.js @@ -156,6 +156,16 @@ function shimInit() { return shim.fetchWithRetry(doFetchOperation, options); } + + shim.uploadBlob = async function(url, options) { + if (!options || !options.path) throw new Error('uploadBlob: source file path is missing'); + const content = await fs.readFile(options.path); + options = Object.assign({}, options, { + body: content, + }); + return shim.fetch(url, options); + } + } module.exports = { shimInit }; \ No newline at end of file diff --git a/ReactNativeClient/lib/shim-init-react.js b/ReactNativeClient/lib/shim-init-react.js index 033508052..c2f9590cd 100644 --- a/ReactNativeClient/lib/shim-init-react.js +++ b/ReactNativeClient/lib/shim-init-react.js @@ -46,10 +46,7 @@ function shimInit() { try { const response = await shim.fetchWithRetry(doFetchBlob, options); - // let response = await RNFetchBlob.config({ - // path: localFilePath - // }).fetch(method, url, headers); - + // Returns an object that's roughtly compatible with a standard Response object let output = { ok: response.respInfo.status < 400,