2

我正在使用 axios 进行发布请求

getSessionId() {
  const endpoint = 'http://localhost:8069/web/session/authenticate/'
  axios.post(endpoint, this.user).then((response) => {
    this.cookie = response.headers
    console.log(response.headers)
  })
}

我知道会话 id 是作为 cookie 的标题,在 vs 代码的终端中我得到了这个

  {                                                                                                                                                                                                       
     'content-type': 'application/json',
     'content-length': '1355',
     'access-control-allow-origin': '*',
     'access-control-allow-methods': 'POST',
     'set-cookie': [
         'session_id=b459a3fe46e0b32b039b6ebded4db308472abbb4;
         Expires=Thu, 04-Jun-2020 23:11:29 GMT; Max-Age=7776000;
         HttpOnly; Path=/'
      ],
     server: 'Werkzeug/0.16.0 Python/3.7.3',
     date: 'Fri, 06 Mar 2020 23:11:29 GMT'
}

但是当我控制台记录浏览器的响应时,它给了我

{
  content-length: "1355"
  content-type: "application/json"
}
4

0 回答 0