Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
34c8652f
Commit
34c8652f
authored
Jul 20, 2020
by
picklesrus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix capitalization: cookie library we use requires sameSite in opts object to have a lowercase s.
parent
10a4e92d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/lib/jar.js
src/lib/jar.js
+1
-1
test/unit/lib/jar.test.js
test/unit/lib/jar.test.js
+5
-5
No files found.
src/lib/jar.js
View file @
34c8652f
...
...
@@ -79,7 +79,7 @@ const Jar = {
opts
=
opts
||
{};
defaults
(
opts
,
{
expires
:
new
Date
(
new
Date
().
setYear
(
new
Date
().
getFullYear
()
+
1
)),
SameSite
:
'
Strict
'
sameSite
:
'
Strict
'
// cookie library requires this capitialization of sameSite
});
opts
.
path
=
'
/
'
;
const
obj
=
cookie
.
serialize
(
name
,
value
,
opts
);
...
...
test/unit/lib/jar.test.js
View file @
34c8652f
...
...
@@ -10,7 +10,7 @@ describe('unit test lib/jar.js', () => {
expect
(
cookie
.
serialize
).
toHaveBeenCalledWith
(
'
name
'
,
'
value
'
,
expect
.
objectContaining
({
path
:
'
/
'
,
S
ameSite
:
'
Strict
'
,
s
ameSite
:
'
Strict
'
,
expires
:
expect
.
anything
()
// not specifically matching the date because it is hard to mock
}));
});
...
...
@@ -21,7 +21,7 @@ describe('unit test lib/jar.js', () => {
expect
.
objectContaining
({
option
:
'
one
'
,
path
:
'
/
'
,
S
ameSite
:
'
Strict
'
,
s
ameSite
:
'
Strict
'
,
expires
:
expect
.
anything
()
// not specifically matching the date because it is hard to mock
}));
});
...
...
@@ -38,16 +38,16 @@ describe('unit test lib/jar.js', () => {
expires
:
'
someday
'
}));
});
test
(
'
S
ameSite opts overrides default
'
,
()
=>
{
test
(
'
s
ameSite opts overrides default
'
,
()
=>
{
jar
.
set
(
'
a
'
,
'
b
'
,
{
option
:
'
one
'
,
S
ameSite
:
'
override
'
s
ameSite
:
'
override
'
});
expect
(
cookie
.
serialize
).
toHaveBeenCalled
();
expect
(
cookie
.
serialize
).
toHaveBeenCalledWith
(
'
a
'
,
'
b
'
,
expect
.
objectContaining
({
option
:
'
one
'
,
S
ameSite
:
'
override
'
s
ameSite
:
'
override
'
}));
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment