]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9834 SQBILLING-52 Reject correctly error response from post request.
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 18 Sep 2017 10:35:01 +0000 (12:35 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 18 Sep 2017 12:51:29 +0000 (14:51 +0200)
server/sonar-web/src/main/js/helpers/request.ts

index 4bac03dadd68a31f9afa5180bd76a70a1491d39c..1acb519e00013806e48ad667f4037f9fd8be5825 100644 (file)
@@ -170,10 +170,10 @@ export function postJSON(url: string, data?: RequestData): Promise<any> {
  * Shortcut to do a POST request
  */
 export function post(url: string, data?: RequestData): Promise<void> {
-  return new Promise(resolve => {
+  return new Promise((resolve, reject) => {
     request(url).setMethod('POST').setData(data).submit().then(checkStatus).then(() => {
       resolve();
-    });
+    }, reject);
   });
 }