Node.js请求模块返回unicode字符

时间:2017-06-07 11:49:40

标签: node.js express npm-request

我正在使用200模块,我的状态代码为��N�0��w9׃t�"���M�� c� ��@\�=���c���}�_YR���c�cߦZ�#�&�Z�~��m�F���+e�{s���gR/����Z�����f7)����Hq�3h��,但正文如下:json ...我怎么能修复它以返回module.exports.userCreate = function(req, res, next) { var user = new User(); var username = req.body.username; var password = req.body.password; user.username = username; user.password = password; var payload = { "username": username, "password": password } var options = { 'method': 'post', 'body': payload, 'content-type': 'application/json', 'json': true, 'url': "https://example.com/api/login" } request(options, function (error, response, body) { console.log(response.statusCode); if (!error && response.statusCode == 200) { console.log(body); } else if(error) { return done(err); } else if(response.statusCode == 401) { return done(null, false, req.flash('loginMessage', 'No user Found')); } }); } 响应?

这是我的代码:

$(function(){
	$(document).ready(function(){
		$(".inputclass").keyup(function() {
					alert($(this).val());
		});
	});
});

0 个答案:

没有答案