Showing
1 changed file
with
7 additions
and
6 deletions
... | @@ -86,11 +86,6 @@ async function handleEvent(event) { | ... | @@ -86,11 +86,6 @@ async function handleEvent(event) { |
86 | .then((stream) => { | 86 | .then((stream) => { |
87 | stream.on('data', (chunk) => { | 87 | stream.on('data', (chunk) => { |
88 | console.log(chunk); | 88 | console.log(chunk); |
89 | - }); | ||
90 | - stream.on('error', (err) => { | ||
91 | - // error handling | ||
92 | - }); | ||
93 | - }); | ||
94 | var cheerio = require('cheerio'); | 89 | var cheerio = require('cheerio'); |
95 | 90 | ||
96 | let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY']; | 91 | let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY']; |
... | @@ -108,7 +103,7 @@ async function handleEvent(event) { | ... | @@ -108,7 +103,7 @@ async function handleEvent(event) { |
108 | 'Content-Type': 'application/octet-stream', | 103 | 'Content-Type': 'application/octet-stream', |
109 | 'Ocp-Apim-Subscription-Key': subscriptionKey | 104 | 'Ocp-Apim-Subscription-Key': subscriptionKey |
110 | }, | 105 | }, |
111 | - body: event.message.image | 106 | + body: chunk |
112 | }; | 107 | }; |
113 | 108 | ||
114 | await request.post(options, function (error, response, body) { | 109 | await request.post(options, function (error, response, body) { |
... | @@ -148,6 +143,12 @@ async function handleEvent(event) { | ... | @@ -148,6 +143,12 @@ async function handleEvent(event) { |
148 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); | 143 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); |
149 | }); | 144 | }); |
150 | }); | 145 | }); |
146 | + }); | ||
147 | + stream.on('error', (err) => { | ||
148 | + // error handling | ||
149 | + }); | ||
150 | + }); | ||
151 | + | ||
151 | }) | 152 | }) |
152 | } | 153 | } |
153 | else if(event.type == 'message' && event.message.type == 'text') | 154 | else if(event.type == 'message' && event.message.type == 'text') | ... | ... |
-
Please register or login to post a comment