diff options
author | Matthew Shao <me@matshao.com> | 2017-08-15 22:21:08 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-08-15 22:21:08 +0800 |
commit | 6560b0dcdba72085ce6c53d68a9e01d293936893 (patch) | |
tree | 3ed2f055f1dda762a3aaa4ac1524ebf305aabe27 /web/src/js/utils.js | |
parent | cbdddefcc8f3ad19e50da5a31532c8abb0cb36f8 (diff) | |
download | mitmproxy-6560b0dcdba72085ce6c53d68a9e01d293936893.tar.gz mitmproxy-6560b0dcdba72085ce6c53d68a9e01d293936893.tar.bz2 mitmproxy-6560b0dcdba72085ce6c53d68a9e01d293936893.zip |
[web] Change the api routing and minor fix.
Diffstat (limited to 'web/src/js/utils.js')
-rw-r--r-- | web/src/js/utils.js | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/web/src/js/utils.js b/web/src/js/utils.js index 505f74df..3aeba1b1 100644 --- a/web/src/js/utils.js +++ b/web/src/js/utils.js @@ -81,27 +81,15 @@ function getCookie(name) { } const xsrf = `_xsrf=${getCookie("_xsrf")}`; - export function fetchApi(url, options={}) { - if (global.MITMWEB_STATIC) { - let path = url.split('/'), - filename = path.pop() - filename += '.json' - path.push(filename) - let new_url = path.join('/') - return _fetchApi(new_url, options) - } else { - return _fetchApi(url, options) - } -} - -function _fetchApi(url, options={}) { if (options.method && options.method !== "GET") { if (url.indexOf("?") === -1) { url += "?" + xsrf; } else { url += "&" + xsrf; } + } else { + url += '.json' } return fetch(url, { @@ -110,7 +98,7 @@ function _fetchApi(url, options={}) { }); } -fetchApi.put = (url, json, options) => _fetchApi( +fetchApi.put = (url, json, options) => fetchApi( url, { method: "PUT", |