From 0d9b2758e9b695d287b6f5f6f0b47060a6e71747 Mon Sep 17 00:00:00 2001 From: Akira Date: Tue, 3 Mar 2026 10:05:25 +0900 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=81=8C=E7=99=BA?= =?UTF-8?q?=E8=A9=B1=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E4=BB=B6=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alexa-api/server.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/alexa-api/server.js b/alexa-api/server.js index 636b147..d458e58 100644 --- a/alexa-api/server.js +++ b/alexa-api/server.js @@ -37,6 +37,7 @@ function httpsRequest(path, options, extraCookies) { extraCookies = extraCookies || ''; return new Promise(function(resolve, reject) { var allCookies = ALEXA_COOKIE + (extraCookies ? '; ' + extraCookies : ''); + var bodyBuf = options.body ? Buffer.from(options.body, 'utf8') : null; var reqOpts = { hostname: ALEXA_HOST, path: path, @@ -46,7 +47,7 @@ function httpsRequest(path, options, extraCookies) { 'Accept': 'application/json, text/plain, */*', 'Accept-Language': 'ja-JP,ja;q=0.9', 'Cookie': allCookies, - }, options.headers || {}), + }, bodyBuf ? { 'Content-Length': bodyBuf.length } : {}, options.headers || {}), }; var req = https.request(reqOpts, function(res) { var body = ''; @@ -54,7 +55,7 @@ function httpsRequest(path, options, extraCookies) { res.on('end', function() { resolve({ status: res.statusCode, headers: res.headers, body: body }); }); }); req.on('error', reject); - if (options.body) req.write(options.body); + if (bodyBuf) req.write(bodyBuf); req.end(); }); } @@ -136,8 +137,9 @@ app.post('/speak', async function(req, res) { deviceType: target.deviceType, deviceSerialNumber: target.serialNumber, customerId: customerId, - locale: '', + locale: 'ja-JP', textToSpeak: text, + speakType: 'ssml' }, }, };