Skip to content

Commit

Permalink
Merge pull request #207 from buttercup/dropbox_axios_write_fix
Browse files Browse the repository at this point in the history
Patch axios for web
  • Loading branch information
perry-mitchell committed Dec 8, 2018
2 parents d4f7075 + ad7a92a commit f975fec
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 21 deletions.
56 changes: 37 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -63,7 +63,7 @@
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"browser-info": "^1.2.0",
"buttercup": "^2.8.1",
"buttercup": "^2.9.2",
"classnames": "^2.2.6",
"concurrently": "^4.1.0",
"console.style": "^0.2.2",
Expand Down Expand Up @@ -96,6 +96,7 @@
"prop-types": "^15.6.2",
"pug": "^2.0.3",
"pug-loader": "^2.4.0",
"query-string": "^6.2.0",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-redux": "^5.0.7",
Expand Down
26 changes: 25 additions & 1 deletion source/background/library/core.js
@@ -1,6 +1,30 @@
import { Web } from "../../shared/library/buttercup.js";
import queryString from "query-string";
import { Datasources, Web } from "../../shared/library/buttercup.js";
import "../../shared/library/LocalFileDatasource.js";

export function initialise() {
Web.HashingTools.patchCorePBKDF();
const { DropboxDatasource, registerDatasourcePostProcessor } = Datasources;
registerDatasourcePostProcessor((type, datasource) => {
if (type === "dropbox") {
datasource.client.patcher.patch("request", args => {
let url = args.url;
if (args.params) {
url += `?${queryString.stringify(args.params)}`;
}
return fetch(url, {
method: args.method || "GET",
headers: args.headers || {},
body: args.data
}).then(resp => {
return resp.text().then(txt => ({
data: txt,
status: resp.status,
statusText: resp.statusText,
headers: resp.headers
}));
});
});
}
});
}

0 comments on commit f975fec

Please sign in to comment.