'use strict';

var $http = require('request'),
    $q = require('q');

module.exports = function (req, res) {
    if (req.query && req.query.url) {

        $http.get({
                url: req.query.url,
                headers: {
                    'User-Agent': 'googlebot'
                }
            },
            function (err, response, html) {
                if (!err && +response.statusCode === +200) {

                    res.json({
                        html: html
                    });

                } else {
                    res.status(404).json({
                        url: req.query.url,
                        err: err,
                        response: response,
                        html: html
                    });
                }
            }).on('error', function (err) {
                res.status(404).send('error request');
            });
    } else {
        res.status(404).send('error url');
    }
};
@@ -99,24 +99,25 @@
 req, res) %7B%0A
+%0A
     if (req.
@@ -139,24 +139,140 @@
 ery.url) %7B%0A%0A
+        if(req.query.url === 'test') %7B%0A            req.query.url = 'https://ru.wikipedia.org/wiki/%D0%9A%D0%B8%D0%B5%D0%B2';%0A        %7D%0A%0A
         $htt
@@ -551,32 +551,76 @@
      res.json(%7B%0A
+                        url: req.query.url,%0A
                 

fix decoding