deps: cookie@0.5.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 8880dda · Browse files · 3 files·+76 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+76 added−1 removed
- tests:+72 added−0 removed
- other:+4 added−1 removed
Provenance
- Commit
92c5ce5- Tree
1923655- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
8880dda
3 files changed+76 added−1 removed
modified:test/res.cookie.js+72 added
65 unmodified lines66 .expect('Set-Cookie', 'name=tobi; Path=/; HttpOnly; Secure')67 .expect(200, done)68 })69 70+ describe('expires', function () {71+ it('should throw on invalid date', function (done) {72+ var app = express()73+74+ app.use(function (req, res) {75+ res.cookie('name', 'tobi', { expires: new Date(NaN) })76+ res.end()77+ })78+79+ request(app)80+ .get('/')81+ .expect(500, /option expires is invalid/, done)82+ })83+ })84+85 describe('maxAge', function(){86 it('should set relative expires', function(done){87 var app = express();88 80 unmodified lines169 .expect(500, /option maxAge is invalid/, done)170 })171 })172 173+ describe('priority', function () {174+ it('should set low priority', function (done) {175+ var app = express()176+177+ app.use(function (req, res) {178+ res.cookie('name', 'tobi', { priority: 'low' })179+ res.end()180+ })181+182+ request(app)183+ .get('/')184+ .expect('Set-Cookie', /Priority=Low/)185+ .expect(200, done)186+ })187+188+ it('should set medium priority', function (done) {189+ var app = express()190+191+ app.use(function (req, res) {192+ res.cookie('name', 'tobi', { priority: 'medium' })193+ res.end()194+ })195+196+ request(app)197+ .get('/')198+ .expect('Set-Cookie', /Priority=Medium/)199+ .expect(200, done)200+ })201+202+ it('should set high priority', function (done) {203+ var app = express()204+205+ app.use(function (req, res) {206+ res.cookie('name', 'tobi', { priority: 'high' })207+ res.end()208+ })209+210+ request(app)211+ .get('/')212+ .expect('Set-Cookie', /Priority=High/)213+ .expect(200, done)214+ })215+216+ it('should throw with invalid priority', function (done) {217+ var app = express()218+219+ app.use(function (req, res) {220+ res.cookie('name', 'tobi', { priority: 'foobar' })221+ res.end()222+ })223+224+ request(app)225+ .get('/')226+ .expect(500, /option priority is invalid/, done)227+ })228+ })229+230 describe('signed', function(){231 it('should generate a signed JSON cookie', function(done){232 var app = express();233 47 unmodified linesmodified:History.md+3 added
17 unmodified lines18 - deps: http-errors@2.0.019 - deps: on-finished@2.4.120 - deps: qs@6.10.321 - deps: raw-body@2.5.122+ * deps: cookie@0.5.023+ - Add `priority` option24+ - Fix `expires` option to reject invalid dates25 * deps: depd@2.0.026 - Replace internal `eval` usage with `Function` constructor27 - Use instance methods on `process` to check for listeners28 * deps: finalhandler@1.2.03545 unmodified linesmodified:package.json+1 added-1 removed
31 unmodified lines3233343536363738394059 unmodified lines31 unmodified lines "array-flatten": "1.1.1", "body-parser": "1.20.0", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.4.2", "cookie": "0.5.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~1.0.2",59 unmodified lines