Ver Fonte

add request headers to proxy

Dotos há 8 anos atrás
pai
commit
6e9cb08d81
1 ficheiros alterados com 2 adições e 3 exclusões
  1. 2 3
      routes/v1.js

+ 2 - 3
routes/v1.js

@@ -41,7 +41,6 @@ function getJSON(req, res, next) {
 
         method = req.method.toUpperCase();
         var _cookies = req.cookies;
-        var headers = { 'user-agent': req.headers['user-agent'] };
         //console.log(headers);
         if (url) {
             var _temp = {};
@@ -62,7 +61,7 @@ function getJSON(req, res, next) {
                     url = url.replace(/\&callback\=(\w+)/, '');
                     request
                         .get(url)
-                        .set(headers)
+                        .set(req.headers)
                         .set(_cookies)
                         .query(_temp)
                         .end(function(err, response) {
@@ -108,7 +107,7 @@ function getJSON(req, res, next) {
                     }
                     request
                         .post(url)
-                        .set(headers)
+                        .set(req.headers)
                         .set(_cookies)
                         .type('form')
                         .send(_temp)