1
버스 보이가 방금 막혔습니다.노드 js busboy 각도 js로 이벤트를 방출하지 않습니다. http http 게시물
3 가지 이벤트 (파일, 필드, 완료)를 모두 테스트했지만 아무 것도 방출되지 않았습니다.
내 각 코드는 다음과 같습니다. 웨이터와
$http({
method : 'POST',
url : mublAConfig.server + '/api/v3/user/friend',
headers : {
'Content-Type' : 'application/x-www-form-urlencoded',
'Authorization' : access_token
},
transformRequest : function(obj) {
var str = [];
for (var p in obj) {
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
}
return str.join('&');
},
data : {
id : $scope.writes[0].input,
say : $scope.writes[1].input
}
}).success(function(data) {
console.log('Received data : ', data);
}).error(function(data) {
console.log('Error! ', data);
});
내가 한 모든 는
내가 그것을 어떻게 를 해결할 수
req.busboy = new busboy({headers:req.headers});
req.pipe(req.busboy);
req.busboy.on('file', function(field, file, name) {
console.log('file event');
});
req.busboy.on('field', function(name, value) {
console.log('field event');
});
req.busboy.on('finish', function() {
console.log('busboy finished');
});
이하입니까?
'Content-Type'과 수동 데이터 변환의 수동 설정이 필요하지 않지만 'req.on ('data ', function (d) {console. dir (d.toString())})'을 실행하고 콘솔에 기록 할 내용을 표시 하시겠습니까? – mscdex
음 ... 아무것도 표시되지 않았습니다. 문제는 각진 부분에 있습니까? – Moonrise
콘텐츠 유형은 반드시 multipart/form-data 여야합니다. –