我的自动化设置对JIRA进行了HTTP调用,其中包括之前从测试结果中提取的变量。该变量有时带有换行符,由于语法问题,该换行符使HTTP调用出错。
{
"fields": {
"project":
{
"key": "Blah"
},
"assignee": {
"name": "Joe"
},
"summary": "Summary",
"description": "${variable}",
"issuetype": {
"name": "Defect"
}
}
在HTTP调用中,$ {variable}替换为:
{
"fields": {
"project":
{
"key": "Blah"
},
"assignee": {
"name": "Joe"
},
"summary": "Summary",
"description": "Test failed: text expected to equal /
****** received :
[[[{"id":700,"status":"FAIL","color":"#D45D52","testKey":"TEST-329","testExecKey":"TEST-355","assig...]]]
****** comparison: [[[asdasdasdasd
]]]
/",
"issuetype": {
"name": "Defect"
}
}
作为回应,我得到了:
{"errorMessages":["Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@39cf8e10; line: 14, column: 62]"]}
如何实现变量以使格式不中断?