1 回答

TA貢獻1921條經驗 獲得超9個贊
首先,如果您不確定,請在 Postman 中執行此操作,然后在代碼中重新創建相同的內容。這樣,您將有一個郵遞員來演示您的編碼問題。
僅用于.queryParam()參數而不用于正文內容。正文內容應低于.body()
用于.multiPart()將文件作為多部分任務上傳。希望這可以幫助。
given().queryParam(
"api_key", "A813302*************",
"method", "my",
"from", "91xxxxxxx")
.body("{\n" +
" \"to\":\"91xxxxxxxx\",\n" +
" \"type\": \"image\", \"image\" : {\"caption\" : \"{{caption}}\"},\n" +
"\"callback\":\"{{callback}}\"\n" +
"}")
.multiPart(new File("C:/Users/sobhit.s/Pictures/SMS-2047.png"))
.when()
.get(ExecutionConfig.BASE_URL)
.prettyPrint();
添加回答
舉報