日本語が発話されない件の修正案
This commit is contained in:
@@ -37,6 +37,7 @@ function httpsRequest(path, options, extraCookies) {
|
|||||||
extraCookies = extraCookies || '';
|
extraCookies = extraCookies || '';
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var allCookies = ALEXA_COOKIE + (extraCookies ? '; ' + extraCookies : '');
|
var allCookies = ALEXA_COOKIE + (extraCookies ? '; ' + extraCookies : '');
|
||||||
|
var bodyBuf = options.body ? Buffer.from(options.body, 'utf8') : null;
|
||||||
var reqOpts = {
|
var reqOpts = {
|
||||||
hostname: ALEXA_HOST,
|
hostname: ALEXA_HOST,
|
||||||
path: path,
|
path: path,
|
||||||
@@ -46,7 +47,7 @@ function httpsRequest(path, options, extraCookies) {
|
|||||||
'Accept': 'application/json, text/plain, */*',
|
'Accept': 'application/json, text/plain, */*',
|
||||||
'Accept-Language': 'ja-JP,ja;q=0.9',
|
'Accept-Language': 'ja-JP,ja;q=0.9',
|
||||||
'Cookie': allCookies,
|
'Cookie': allCookies,
|
||||||
}, options.headers || {}),
|
}, bodyBuf ? { 'Content-Length': bodyBuf.length } : {}, options.headers || {}),
|
||||||
};
|
};
|
||||||
var req = https.request(reqOpts, function(res) {
|
var req = https.request(reqOpts, function(res) {
|
||||||
var body = '';
|
var body = '';
|
||||||
@@ -54,7 +55,7 @@ function httpsRequest(path, options, extraCookies) {
|
|||||||
res.on('end', function() { resolve({ status: res.statusCode, headers: res.headers, body: body }); });
|
res.on('end', function() { resolve({ status: res.statusCode, headers: res.headers, body: body }); });
|
||||||
});
|
});
|
||||||
req.on('error', reject);
|
req.on('error', reject);
|
||||||
if (options.body) req.write(options.body);
|
if (bodyBuf) req.write(bodyBuf);
|
||||||
req.end();
|
req.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -136,8 +137,9 @@ app.post('/speak', async function(req, res) {
|
|||||||
deviceType: target.deviceType,
|
deviceType: target.deviceType,
|
||||||
deviceSerialNumber: target.serialNumber,
|
deviceSerialNumber: target.serialNumber,
|
||||||
customerId: customerId,
|
customerId: customerId,
|
||||||
locale: '',
|
locale: 'ja-JP',
|
||||||
textToSpeak: text,
|
textToSpeak: text,
|
||||||
|
speakType: 'ssml'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user