请求增加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 = { let obj = {
method: method, method: method,
headers: new Headers({ headers: new Headers({
'authorization': sessionStorage.getItem("authorization") 'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
}), }),
body: params, body: params,
} }
@ -65,7 +66,8 @@ const upload = (method, url, params, responseType) => {
var obj = { var obj = {
responseType: 'blob', responseType: 'blob',
headers: new Headers({ headers: new Headers({
'authorization': sessionStorage.getItem("authorization") 'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
}) })
}; };
if (method == "get") { if (method == "get") {
@ -118,7 +120,8 @@ const upload = (method, url, params, responseType) => {
if (method == "get") { if (method == "get") {
obj = { obj = {
headers: new Headers({ headers: new Headers({
'authorization': sessionStorage.getItem("authorization") 'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
}) })
} }
if (params) { if (params) {
@ -188,7 +191,8 @@ const req = (method, url, params, responseType) => {
if (method == "get") { if (method == "get") {
obj = { obj = {
headers: new Headers({ headers: new Headers({
'authorization': sessionStorage.getItem("authorization") 'authorization': sessionStorage.getItem("authorization"),
'Version':'v1.0.2'
}) })
} }
if (params) { if (params) {
@ -208,7 +212,8 @@ const req = (method, url, params, responseType) => {
method: "post", method: "post",
body: JSON.stringify(params), body: JSON.stringify(params),
headers: new Headers({ 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), body: JSON.stringify(params),
headers: new Headers({ headers: new Headers({
'Content-Type': 'application/json', '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) { xhr.onreadystatechange = function (response) {
response.header = { response.header = {
'Accept': 'application/json', 'Accept': 'application/json',
'Version':'v1.0.2',
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
} }
let uniques = xhr.getResponseHeader('Unique-Str') let uniques = xhr.getResponseHeader('Unique-Str')