Skip to content

Commit

Permalink
Merge branch 'release/1.0.22'
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Mar 18, 2018
2 parents 0c01e60 + df0ed73 commit 6739f96
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="1.0.22"></a>
## [1.0.22](https://github.com/adonisjs/adonis-session/compare/v1.0.21...v1.0.22) (2018-03-18)


### Bug Fixes

* **session:** allow readonly access to store when freezed ([49282d7](https://github.com/adonisjs/adonis-session/commit/49282d7))



<a name="1.0.21"></a>
## [1.0.21](https://github.com/adonisjs/adonis-session/compare/v1.0.20...v1.0.21) (2018-03-16)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adonisjs/session",
"version": "1.0.21",
"version": "1.0.22",
"description": "This repo is the official session provider for Adonisjs apps. It supports multiple drivers to store session data.",
"main": "providers/SessionProvider",
"directories": {
Expand Down
4 changes: 0 additions & 4 deletions src/Session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ class Session {
*/
get (...args) {
this._ensureInitiated()
this._ensureNotFreezed()

return this._store.get(...args)
}

Expand All @@ -219,8 +217,6 @@ class Session {
*/
all (...args) {
this._ensureInitiated()
this._ensureNotFreezed()

return this._store.all(...args)
}

Expand Down
20 changes: 20 additions & 0 deletions test/session.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,26 @@ test.group('Session', () => {
assert.notProperty(headers, 'set-cookie')
assert.match(text, /E_RUNTIME_ERROR: Session store is freezed and you cannot write values to session/)
})

test('should be able to access values in freezed state', async (assert) => {
const server = http.createServer((req, res) => {
const config = new Config()
const cookie = new Cookie(config)
cookie.setRequest(helpers.getRequest(req), helpers.getResponse(res))
const session = new Session(helpers.getRequest(req), helpers.getResponse(res), cookie, config)
session
.instantiate(true)
.then(() => {
res.end(session.get('username'))
}).catch(({ message }) => {
res.writeHead(500)
res.end(message)
})
})

const { text } = await supertest(server).get('/').expect(200)
assert.equal(text, '')
})
})

test.group('Session Store', () => {
Expand Down

0 comments on commit 6739f96

Please sign in to comment.