Explorar el Código

添加请求头Ds-Host

seimin hace 8 meses
padre
commit
cb0adfdd86
Se han modificado 1 ficheros con 8 adiciones y 2 borrados
  1. 8 2
      http/http.js

+ 8 - 2
http/http.js

@@ -1,6 +1,10 @@
1 1
 // #ifdef H5
2 2
 import wx from 'weixin-jsapi'
3 3
 // #endif
4
+let dsHost = "";
5
+// #ifdef H5
6
+dsHost = location.hostname;
7
+// #endif
4 8
 
5 9
 export const path = `${location.origin}/service`
6 10
 // get方法
@@ -11,7 +15,8 @@ export function get(url, data = {}) {
11 15
       url,
12 16
       data,
13 17
       header: {
14
-        'Cache-Control': 'no-cache'
18
+        'Cache-Control': 'no-cache',
19
+        'Ds-Host': dsHost,
15 20
       },
16 21
       success(res) {
17 22
         if(res.statusCode === 200){
@@ -43,7 +48,8 @@ export function post(url, data = {}) {
43 48
       url,
44 49
       data,
45 50
       header: {
46
-        'Cache-Control': 'no-cache'
51
+        'Cache-Control': 'no-cache',
52
+        'Ds-Host': dsHost,
47 53
       },
48 54
       success(res) {
49 55
         if(res.statusCode === 200){