Skip to content

Commit f725443

Browse files
committed
1 parent 7a8a05c commit f725443

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

API.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,8 @@ for performing injections, with some additional options and response properties:
13801380
- `close` - if `true`, emits a `'close'` event after payload transmission (if any).
13811381
Defaults to `false`.
13821382
- `end` - if `false`, does not end the stream. Defaults to `true`.
1383+
- `validate` - if `false`, the `options` inputs are not validated. This is recommended for run-time
1384+
usage of `inject()` to make it perform faster where input validation can be tested separately.
13831385
- `callback` - the callback function with signature `function(res)` where:
13841386
- `res` - the response object where:
13851387
- `statusCode` - the HTTP status code.
@@ -1859,12 +1861,12 @@ across multiple requests. Registers a cookie definitions where:
18591861
- `options` - are the optional cookie settings:
18601862
- `ttl` - time-to-live in milliseconds. Defaults to `null` (session time-life - cookies are
18611863
deleted when the browser is closed).
1862-
- `isSecure` - sets the 'Secure' flag. Defaults to `false`.
1863-
- `isHttpOnly` - sets the 'HttpOnly' flag. Defaults to `false`.
1864+
- `isSecure` - sets the 'Secure' flag. Defaults to `true`.
1865+
- `isHttpOnly` - sets the 'HttpOnly' flag. Defaults to `true`.
18641866
- `isSameSite` - sets the 'SameSite' flag where the value must be one of:
1865-
- `false` - no flag (this is the default value).
1866-
- `'Strict'` - sets the value to `'Strict'`,
1867-
- `'Lax'` - sets the value to `'Lax'`,
1867+
- `false` - no flag.
1868+
- `'Strict'` - sets the value to `'Strict'` (this is the default value).
1869+
- `'Lax'` - sets the value to `'Lax'`.
18681870
- `path` - the path scope. Defaults to `null` (no path).
18691871
- `domain` - the domain scope. Defaults to `null` (no domain).
18701872
- `autoValue` - if present and the cookie was not received from the client or explicitly set by

npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
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
@@ -33,7 +33,7 @@
3333
"mimos": "3.x.x",
3434
"podium": "^1.2.x",
3535
"shot": "3.x.x",
36-
"statehood": "4.x.x",
36+
"statehood": "5.x.x",
3737
"subtext": "^4.2.x",
3838
"topo": "2.x.x"
3939
},

test/response.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('Response', () => {
7575
expect(res.statusMessage).to.equal('Super');
7676
expect(res.headers['cache-control']).to.equal('max-age=1, must-revalidate, private');
7777
expect(res.headers['content-type']).to.equal('text/plain; something=something; charset=ISO-8859-1');
78-
expect(res.headers['set-cookie']).to.equal(['abc=123', 'sid=YWJjZGVmZzEyMzQ1Ng==', 'other=something; Secure', 'x=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT', 'test=123', 'empty=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/path', 'always=present']);
78+
expect(res.headers['set-cookie']).to.equal(['abc=123', 'sid=YWJjZGVmZzEyMzQ1Ng==; Secure; HttpOnly; SameSite=Strict', 'other=something; Secure; HttpOnly; SameSite=Strict', 'x=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=Strict', 'test=123; Secure; HttpOnly; SameSite=Strict', 'empty=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=Strict; Path=/path', 'always=present; Secure; HttpOnly; SameSite=Strict']);
7979
expect(res.headers.vary).to.equal('x-control,accept-encoding');
8080
expect(res.headers.combo).to.equal('o-k');
8181
done();
@@ -347,7 +347,7 @@ describe('Response', () => {
347347
server.inject('/', (res) => {
348348

349349
expect(res.statusCode).to.equal(200);
350-
expect(res.headers['set-cookie']).to.equal(['session=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; Path=/unset']);
350+
expect(res.headers['set-cookie']).to.equal(['session=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=Strict; Path=/unset']);
351351
done();
352352
});
353353
});
@@ -734,7 +734,7 @@ describe('Response', () => {
734734

735735
expect(res.result).to.equal('x');
736736
expect(res.headers.xcustom).to.equal('other value');
737-
expect(res.headers['set-cookie']).to.equal(['a=1', 'b=2']);
737+
expect(res.headers['set-cookie']).to.equal(['a=1', 'b=2; Secure; HttpOnly; SameSite=Strict']);
738738
done();
739739
});
740740
});

test/state.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('state', () => {
170170
server.inject({ method: 'GET', url: '/', headers: { cookie: 'a=x' } }, (res) => {
171171

172172
expect(res.statusCode).to.equal(200);
173-
expect(res.headers['set-cookie'][0]).to.equal('a=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT');
173+
expect(res.headers['set-cookie'][0]).to.equal('a=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=Strict');
174174
done();
175175
});
176176
});
@@ -190,7 +190,7 @@ describe('state', () => {
190190
server.inject('/', (res) => {
191191

192192
expect(res.statusCode).to.equal(200);
193-
expect(res.headers['set-cookie']).to.equal(['always=present']);
193+
expect(res.headers['set-cookie']).to.equal(['always=present; Secure; HttpOnly; SameSite=Strict']);
194194
done();
195195
});
196196
});
@@ -210,7 +210,7 @@ describe('state', () => {
210210
server.inject('/', (res) => {
211211

212212
expect(res.statusCode).to.equal(200);
213-
expect(res.headers['set-cookie']).to.equal(['onecookie=yes', 'twocookie=no', 'always=present']);
213+
expect(res.headers['set-cookie']).to.equal(['onecookie=yes', 'twocookie=no', 'always=present; Secure; HttpOnly; SameSite=Strict']);
214214
done();
215215
});
216216
});
@@ -235,7 +235,7 @@ describe('state', () => {
235235
server.inject('/sweet', (res) => {
236236

237237
expect(res.statusCode).to.equal(200);
238-
expect(res.headers['set-cookie']).to.equal(['always=sweet']);
238+
expect(res.headers['set-cookie']).to.equal(['always=sweet; Secure; HttpOnly; SameSite=Strict']);
239239
done();
240240
});
241241
});
@@ -280,7 +280,7 @@ describe('state', () => {
280280
server.inject('/', (res) => {
281281

282282
expect(res.statusCode).to.equal(200);
283-
expect(res.headers['set-cookie']).to.equal(['a=b']);
283+
expect(res.headers['set-cookie']).to.equal(['a=b; Secure; HttpOnly; SameSite=Strict']);
284284
done();
285285
});
286286
});

0 commit comments

Comments
 (0)