3 回答

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超3個(gè)贊
你還不能直接獲取服務(wù)器端口,但你可以獲取入站端口,這通常具有相同的效果:
{{{request.requestLine.port}}}

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超11個(gè)贊
注意力!不要忘記添加 “transformers”:[“response-template”]
"response": {
...
"jsonBody": { "url": "http://localhost:{{port.request}}" },
"transformers": ["response-template"]
...
}

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
要解決這個(gè)問題,謝謝@Tom的建議是:
{
"priority": 1,
"request": {
"method": "GET",
"url": "/api/public/v3/tasks/taskid123"
},
"response": {
"status": 200,
"jsonBody": {
"info": {
"result_callbacks": [{
"url": "http://localhost:{{request.requestLine.port}}/download/zip/result"
}]
}
},
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"transformers": [
"response-template"
]
}
}
添加回答
舉報(bào)