Browse Source

AMBARI-5902. Views: Set Accept header to "text/plain" for some requests. (alexantonenko)

Alex Antonenko 11 years ago
parent
commit
66d8d5bf7b
1 changed files with 12 additions and 3 deletions
  1. 12 3
      contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js

+ 12 - 3
contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js

@@ -32,12 +32,20 @@ var urls = {
 
   'mapper.applicationTypes': {
     real: 'apptypes?fields=*',
-    mock: '/data/apptypes/all_fields.json'
+    mock: '/data/apptypes/all_fields.json',
+    headers: {
+      Accept : "text/plain; charset=utf-8",
+      "Content-Type": "text/plain; charset=utf-8"
+    }
   },
 
   'mapper.applicationApps': {
     real: 'apps/?fields=*',
-    mock: '/data/apps/apps.json'
+    mock: '/data/apps/apps.json',
+    headers: {
+      Accept : "text/plain; charset=utf-8",
+      "Content-Type": "text/plain; charset=utf-8"
+    }
   },
 
   'mapper.applicationStatus': {
@@ -101,7 +109,8 @@ var formatRequest = function (data) {
   var opt = {
     type: this.type || 'GET',
     dataType: 'json',
-    async: true
+    async: true,
+    headers: this.headers || {accepts: "application/json; charset=utf-8"}
   };
   if (App.get('testMode')) {
     opt.url = formatUrl(this.mock ? this.mock : '', data);