新建一個 startupPost.json
[ { "description":"模擬一個post請求", "request":{ "uri":"/postDemo", "method":"post" }, "response":{ "text":"這是一個post請求" } }, { "description":"模擬一個帶參數的post請求", "request":{ "uri":"/postwithparam", "method":"post", "forms":{ "name":"huhanshan", "age":"18" } }, "response":{ "text":"這是一個帶參數的post請求,胡漢山帶着參數又回來了" } } ]
注意,post里面的參數和get不一樣,get是用的queries關鍵字,但是post用到的是forms關鍵字 ,他不可以在瀏覽器中看結果,因為,瀏覽器中只可以允許get請求。所以在瀏覽器訪問會出現錯誤:顯示400錯誤
如何訪問呢?需要在jmeter中看結果:
結果:
響應數據: