回答編集履歴
1
エラーの処理周りをちょっと修正
answer
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
}
|
31
31
|
const send_options = {
|
32
32
|
host: 'api.line.me',
|
33
|
-
path:
|
33
|
+
path: `/v2/bot/message/${it.object}/content`,
|
34
34
|
headers: {
|
35
35
|
"Content-type": "application/json; charset=UTF-8",
|
36
36
|
"Authorization": " Bearer {" + Token + "}",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
var data = [];
|
42
42
|
res
|
43
43
|
.on('data', chunk => { data.push(new Buffer(chunk)) })
|
44
|
-
.on('error', err => {
|
44
|
+
.on('error', err => { done(err, null) })
|
45
45
|
.on('end', () => {
|
46
46
|
//データが細切れになっているので連結。
|
47
47
|
var result = Buffer.concat(data);
|
@@ -52,9 +52,10 @@
|
|
52
52
|
});
|
53
53
|
|
54
54
|
async.series(functions, (err, results) => {
|
55
|
+
if (err) console.error(err);
|
55
56
|
// results内にdoneの第二引数の配列が詰まっているはずなので確認してください。
|
56
57
|
console.log(results);
|
57
|
-
console.log(results.filter(it =>
|
58
|
+
console.log(results.filter(it => it != null)); // Null除去
|
58
59
|
});
|
59
60
|
```
|
60
61
|
|