Skip to content

Commit e04a8e6

Browse files
committed
Upgrading fetch-cookie and how it is imported
1 parent 7c432e2 commit e04a8e6

File tree

3 files changed

+58
-102
lines changed

3 files changed

+58
-102
lines changed

package-lock.json

Lines changed: 53 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"eslint-config-airbnb-base": "~15",
5757
"eslint-plugin-import": "^2.32.0",
5858
"eslint-plugin-no-only-tests": "^3.3.0",
59-
"fetch-cookie": "^2.2.0",
59+
"fetch-cookie": "^3.1.0",
6060
"http-proxy-middleware": "^2.0.9",
6161
"jsonschema": "^1.5.0",
6262
"lodash": "^4.17.21",

test/util/authenticate-user.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Allow main functionality to stay at top of file:
22
/* eslint-disable no-use-before-define */
33

4-
const makeFetchCookie = require('fetch-cookie');
4+
// fetch-cookie v3+ is an ES module, so we need to destructure the default export when using require()
5+
const { default: fetchCookie } = require('fetch-cookie');
56

67
module.exports = async (service, user, includeCsrf) => {
78
if (!user) throw new Error('Did you forget the **service** arg?');
@@ -31,14 +32,14 @@ async function oidcAuthFor(service, user) {
3132

3233
// custom cookie jar probably not important, but we will need these cookies
3334
// for the final redirect
34-
const cookieJar = new makeFetchCookie.toughCookie.CookieJar();
35+
const cookieJar = new fetchCookie.toughCookie.CookieJar();
3536
res1.headers['set-cookie'].forEach(cookieString => {
3637
cookieJar.setCookie(cookieString, 'http://localhost:8383/v1/oidc/login');
3738
});
3839

3940
const location1 = res1.headers.location;
4041

41-
const fetchC = makeFetchCookie(fetch, cookieJar);
42+
const fetchC = fetchCookie(fetch, cookieJar);
4243
const res2 = await fetchC(location1);
4344
if (res2.status !== 200) throw new Error('Non-200 response');
4445

0 commit comments

Comments
 (0)