mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
Support credentials true #15
This commit is contained in:
@ -23,7 +23,7 @@ if (fs.existsSync(process.cwd() + '/public')) {
|
||||
server.use(express.static(path.join(__dirname, './public')));
|
||||
}
|
||||
|
||||
server.use(cors())
|
||||
server.use(cors({ origin: true, credentials: true }))
|
||||
server.use(server.router)
|
||||
|
||||
if ('development' == server.get('env')) {
|
||||
|
@ -36,7 +36,10 @@ describe('Server', function() {
|
||||
it('should respond with json and corresponding resources', function(done) {
|
||||
request(server)
|
||||
.get('/posts')
|
||||
.set('Origin', 'http://example.com')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Access-Control-Allow-Credentials', 'true')
|
||||
.expect('Access-Control-Allow-Origin', 'http://example.com')
|
||||
.expect(low.db.posts)
|
||||
.expect(200, done)
|
||||
})
|
||||
|
Reference in New Issue
Block a user