게시하고 쿠키를 가져 오려고합니다. 나는 초보자이며 이것은 나를위한 학습 프로젝트입니다. 내 인상은 당신이 'set-cookie'를 사용하면 .toSource에서 추가 'set-cookie'를 볼 수 있어야한다는 것이다. (차이를 만드는 경우 Google Apps 사이트에서이를 수행하려고합니다.) 내가 누락 되었습니까? 여기 내 코드 :Google Apps 스크립트 및 쿠키
function setGetCookies() {
var payload = {'set-cookie' : 'test'};
var opt2 = {'headers':payload, "method":"post"};
UrlFetchApp.fetch("https://sites.google.com/a/example.com/blacksmith", opt2);
var response = UrlFetchApp.fetch("https://sites.google.com/a/example.com/blacksmith")
var openId = response.getAllHeaders().toSource();
Logger.log(openId)
var AllHeaders = response.getAllHeaders();
for (var prop in AllHeaders) {
if (prop.toLowerCase() == "set-cookie") {
// if there's only one cookie, convert it into an array:
var myArray = [];
if (Array.isArray(AllHeaders[prop])) {
myArray=AllHeaders[prop];
} else {
myArray[0]=AllHeaders[prop];
}
// now process the cookies
myArray.forEach(function(cookie) {
Logger.log(cookie);
});
break;
}
}
}
미리 감사드립니다! 나는 코드를 개발하기 위해 이것을 참조했다. Cookie handling in Google Apps Script - How to send cookies in header?
어떤 조언이 있어도 열람 할 수있다.