aboutsummaryrefslogtreecommitdiffstats
path: root/web/src
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-06-17 21:05:30 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-06-17 21:05:30 -0700
commit6a41ea91714711f2edc07af0329621de3191aa22 (patch)
treec7720eaed1885bc7aab47132519a96c38b9e1e8c /web/src
parentce53799c623a8ac74631f6fc4ab8fb134bff1cc8 (diff)
downloadmitmproxy-6a41ea91714711f2edc07af0329621de3191aa22.tar.gz
mitmproxy-6a41ea91714711f2edc07af0329621de3191aa22.tar.bz2
mitmproxy-6a41ea91714711f2edc07af0329621de3191aa22.zip
add fetchApi.put shortcut
Diffstat (limited to 'web/src')
-rw-r--r--web/src/js/utils.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/web/src/js/utils.js b/web/src/js/utils.js
index 2e5c3005..2e25016e 100644
--- a/web/src/js/utils.js
+++ b/web/src/js/utils.js
@@ -109,7 +109,19 @@ export function fetchApi(url, options) {
url += "&" + xsrf;
}
return fetch(url, {
- ...options,
- credentials: 'same-origin'
+ credentials: 'same-origin',
+ ...options
});
-} \ No newline at end of file
+}
+
+fetchApi.put = (url, json, options) => fetchApi(
+ url,
+ {
+ method: "PUT",
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(json),
+ ...options
+ }
+)