aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/request.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/request.js')
-rw-r--r--server/sonar-web/src/main/js/helpers/request.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/request.js b/server/sonar-web/src/main/js/helpers/request.js
index 61eff255eaf..86e9b8242e3 100644
--- a/server/sonar-web/src/main/js/helpers/request.js
+++ b/server/sonar-web/src/main/js/helpers/request.js
@@ -133,3 +133,17 @@ export function postJSON (url, data) {
.then(checkStatus)
.then(parseJSON);
}
+
+
+/**
+ * Shortcut to do a POST request and return response json
+ * @param url
+ * @param data
+ */
+export function post (url, data) {
+ return request(url)
+ .setMethod('POST')
+ .setData(data)
+ .submit()
+ .then(checkStatus);
+}