fix api response header
This commit is contained in:
parent
bcde70bbfb
commit
09aa61efe2
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue