请求增加header信息Version:v1.0.2

This commit is contained in:
red-deng-deng 2021-12-17 09:52:33 +08:00
parent f977c2d187
commit 8db3d03eea
2 changed files with 13 additions and 6 deletions

View File

@ -26,7 +26,8 @@ const upload = (method, url, params, responseType) => {
let obj = {
method: method,
headers: new Headers({
'authorization': sessionStorage.getItem("authorization")
'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
}),
body: params,
}
@ -65,7 +66,8 @@ const upload = (method, url, params, responseType) => {
var obj = {
responseType: 'blob',
headers: new Headers({
'authorization': sessionStorage.getItem("authorization")
'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
})
};
if (method == "get") {
@ -118,7 +120,8 @@ const upload = (method, url, params, responseType) => {
if (method == "get") {
obj = {
headers: new Headers({
'authorization': sessionStorage.getItem("authorization")
'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
})
}
if (params) {
@ -188,7 +191,8 @@ const req = (method, url, params, responseType) => {
if (method == "get") {
obj = {
headers: new Headers({
'authorization': sessionStorage.getItem("authorization")
'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
})
}
if (params) {
@ -208,7 +212,8 @@ const req = (method, url, params, responseType) => {
method: "post",
body: JSON.stringify(params),
headers: new Headers({
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Version':'v1.0.2'
})
}
@ -220,7 +225,8 @@ const req = (method, url, params, responseType) => {
body: JSON.stringify(params),
headers: new Headers({
'Content-Type': 'application/json',
'authorization': sessionStorage.getItem("authorization")
'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
})
}
}

View File

@ -135,6 +135,7 @@ function FormDom(props) {
xhr.onreadystatechange = function (response) {
response.header = {
'Accept': 'application/json',
'Version':'v1.0.2',
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
}
let uniques = xhr.getResponseHeader('Unique-Str')