Skip to content

Commit c0d43ef

Browse files
committed
Support credentials true #15
1 parent ba15b5a commit c0d43ef

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (fs.existsSync(process.cwd() + '/public')) {
2323
server.use(express.static(path.join(__dirname, './public')));
2424
}
2525

26-
server.use(cors())
26+
server.use(cors({ origin: true, credentials: true }))
2727
server.use(server.router)
2828

2929
if ('development' == server.get('env')) {

test/server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ describe('Server', function() {
3636
it('should respond with json and corresponding resources', function(done) {
3737
request(server)
3838
.get('/posts')
39+
.set('Origin', 'http://example.com')
3940
.expect('Content-Type', /json/)
41+
.expect('Access-Control-Allow-Credentials', 'true')
42+
.expect('Access-Control-Allow-Origin', 'http://example.com')
4043
.expect(low.db.posts)
4144
.expect(200, done)
4245
})

0 commit comments

Comments
 (0)