Update jlqc.js

This commit is contained in:
smallfawn
2023-01-22 18:43:54 +08:00
committed by GitHub
parent 32389ea9cc
commit a597fac4bd

View File

@@ -402,7 +402,7 @@ function randomszdx(e) {
function changeCode(oldoptions) { function changeCode(oldoptions) {
let newoptions = new Object() let newoptions = new Object()
newoptions.url = changeUrl(oldoptions) newoptions.url = changeUrl(oldoptions)
newoptions.headers = oldoptions.headers 'content-type' in oldoptions.headers ? newoptions.headers = changeHeaders(oldoptions.headers) : newoptions.headers = oldoptions.headers
function changeUrl(options) { function changeUrl(options) {
let urlParameter let urlParameter
'qs' in options ? urlParameter = changeUrlParameter('qs') : ('params' in options ? urlParameter = changeUrlParameter('params') : urlParameter = options.url) 'qs' in options ? urlParameter = changeUrlParameter('qs') : ('params' in options ? urlParameter = changeUrlParameter('params') : urlParameter = options.url)
@@ -414,6 +414,12 @@ function changeCode(oldoptions) {
} }
return urlParameter return urlParameter
} }
function changeHeaders(headers) {
let tmp = headers['content-type']
delete headers['content-type']
headers['Content-Type'] = tmp
return headers
}
'body' in oldoptions ? ((Object.prototype.toString.call(oldoptions.body) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.body) : newoptions.body = oldoptions.body) : '' 'body' in oldoptions ? ((Object.prototype.toString.call(oldoptions.body) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.body) : newoptions.body = oldoptions.body) : ''
'data' in oldoptions ? ((Object.prototype.toString.call(oldoptions.data) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.data) : newoptions.body = oldoptions.data) : '' 'data' in oldoptions ? ((Object.prototype.toString.call(oldoptions.data) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.data) : newoptions.body = oldoptions.data) : ''
'form' in oldoptions ? ((Object.prototype.toString.call(oldoptions.form) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.form) : newoptions.body = oldoptions.form) : '' 'form' in oldoptions ? ((Object.prototype.toString.call(oldoptions.form) === '[object Object]') ? newoptions.body = JSON.stringify(oldoptions.form) : newoptions.body = oldoptions.form) : ''