Skip to content

Commit

Permalink
add: getSetCookie() to get cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
BANKA2017 committed Feb 5, 2024
1 parent fa92635 commit 1b1e15a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kdwnil/translator-utils",
"private": true,
"version": "0.0.2-alpha.29",
"version": "0.0.2-alpha.30",
"description": "translate utils",
"homepage": "https://github.com/BANKA2017/translator-utils",
"bugs": {
Expand Down
5 changes: 4 additions & 1 deletion packages/translator-utils-axios-helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ class AxiosRequest {

let headers = Object.fromEntries(res.headers.entries())

if (headers['set-cookie'] && res.headers.getAll) {
if (headers['set-cookie'] && res.headers.getSetCookie) {
//https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie
headers['set-cookie'] = res.headers.getSetCookie()
} else if (headers['set-cookie'] && res.headers.getAll) {
//workers
//TypeError: getAll() can only be used with the header name "Set-Cookie".
headers['set-cookie'] = res.headers.getAll('set-cookie')
Expand Down

0 comments on commit 1b1e15a

Please sign in to comment.