Http Client include js file (for Response validation)

已回答

#community_comment_360001402180 Same question.

Is there any way how to include some shared code ?

For example

DELETE {{ host }}/api/1.0/foo/bar
Content-Type: application/json;charset=UTF-8
<%
// Duplicate code for every response validation
const isEqual = (expect, actual) => client.assert(expect == actual, `\nexpect: ${expect}, but actual: ${JSON.stringify(actual)}`)
const print = (testName, response) => {client.log(`\n${testName} Response\n${JSON.stringify(response, null, 2)}`)};
//

client.test("Delete foo", () => {
print("foo response", response)
isEqual(200, response.status)
isEqual(null, response.body["data"])
}
%>

 

any updates in 2022? 

评论操作 固定链接

It is not yet supported in IntelliJ IDEA's HTTP Client I'm afraid.

Please upvote https://youtrack.jetbrains.com/issue/IDEA-287544

0

请先登录再写评论。