|
|
@ -30,16 +30,20 @@ export class Session {
|
|
|
|
dataType: dataType,
|
|
|
|
dataType: dataType,
|
|
|
|
responseType: responseType,
|
|
|
|
responseType: responseType,
|
|
|
|
success: (res) => {
|
|
|
|
success: (res) => {
|
|
|
|
|
|
|
|
let cookies =[];
|
|
|
|
if ("cookies" in res) {
|
|
|
|
if ("cookies" in res) {
|
|
|
|
let cookies = res["cookies"];
|
|
|
|
cookies = res["cookies"];
|
|
|
|
|
|
|
|
} else if(res.header["Set-Cookie"]){
|
|
|
|
|
|
|
|
cookies = res.header["Set-Cookie"].replace(", ", "@@").replace(",","||").replace("@@",", ").split("||");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
console.warn("request.js: no cookies setted in this request");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("raw_cookies", cookies);
|
|
|
|
for (var i = 0; i < cookies.length; i++) {
|
|
|
|
for (var i = 0; i < cookies.length; i++) {
|
|
|
|
this.set_cookie(new Cookie(cookies[i]));
|
|
|
|
this.set_cookie(new Cookie(cookies[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("set new cookies:");
|
|
|
|
console.log("set new cookies:");
|
|
|
|
console.log(this.cookies);
|
|
|
|
console.log(this.cookies);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.warn("request.js: no cookies setted in this request");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof success == "function") {
|
|
|
|
if (typeof success == "function") {
|
|
|
|
success(res);
|
|
|
|
success(res);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|