fix api response header

This commit is contained in:
DIYgod 2017-04-16 15:01:56 +08:00
parent bcde70bbfb
commit 09aa61efe2
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
3 changed files with 5 additions and 1 deletions

View File

@ -2,7 +2,7 @@ module.exports = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
res.header('content-type', 'application/json; charset=utf-8');
res.header('Cache-control', 'no-cache');
if (req.method == 'OPTIONS') {
res.send(200);

View File

@ -5,6 +5,8 @@ var fetch = require('node-fetch');
var parseString = require('xml2js').parseString;
module.exports = function (req, res) {
res.header('content-type', 'application/json; charset=utf-8');
var ip = req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||

View File

@ -4,6 +4,8 @@ var danmaku = require('../models/danmaku');
var redis = require('../tools/redis');
module.exports = function (req, res) {
res.header('content-type', 'application/json; charset=utf-8');
var ip = req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||