私は電子メールを送信するためのAPIを書いています。私はこれにPostmanを使用しています。通常のテキストで正常に動作しています。 "HTML"にスクリプトタグを追加すると、次のエラーが発生します。レスポンスボディJavaScriptで動作しないJavaScriptタグが
SyntaxError: Unexpected token
at Object.parse (native)
at parse (/root/node_modules/body-parser/lib/types/json.js:88:17)
at /root/node_modules/body-parser/lib/read.js:116:18
at invokeCallback (/root/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
at done (/root/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
at IncomingMessage.onEnd (/root/node_modules/body-parser/node_modules/raw-body/index.js:307:7)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
at process._tickDomainCallback (node.js:459:13)
と
400 Bad Request
私が送りますリクエストボディです:JSONはに基づいて改行
を許可していませんでした
{
"from": "\"David Johnson\" <[email protected]>",
"to": "[email protected]",
"subject": "Test",
"html": "Dear David, <br /> <br /> Thanks for the mail. PFB the detailed report.
<script src=\"https://code.highcharts.com/highcharts.js\"></script>
<script src=\"https://code.highcharts.com/modules/exporting.js\"></script>
<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>
<script>
Highcharts.chart('container',
{
chart: {
type: 'areaspline'
},
title: {
text: 'Bandwidth Utilization'
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 150,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
xAxis: {
categories: [
'00: 00',
'01: 00',
'02: 00',
'03: 00',
'04: 00',
'05: 00',
'06: 00',
'07: 00',
'08: 00',
'09: 00',
'10: 00',
'11: 00',
'12: 00',
'13: 00',
'14: 00',
'15: 00',
'16: 00',
'17: 00',
'18: 00',
'19: 00',
'20: 00',
'21: 00',
'22: 00',
'23: 00'
],
title: {
text: 'Hours (GMT)'
}
},
yAxis: {
title: {
text: 'Bandwidth (Mbps)'
}
},
tooltip: {
shared: true,
valueSuffix: ' Mbps'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
}
},
series: [
{
name: 'India - (GMT +5.5)',
data: [
3,
5,
4,
10,
12,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
4,
3
]
},
{
name: 'Ireland - (GMT +0.0)',
data: [
1,
3,
4,
3,
3,
5,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
name: 'Samoa - (GMT -11.0)',
data: [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
4,
4,
9,
15,
10,
12,
0,
0,
0,
0
]
}
]
});
</script>"
}
おかげで、@Roman。それは正常に動作しています。 :) –