開始用fiddler抓app包,後來想模擬一下post請求,發現一直接受不到,wtf?json
User-Agent: Fiddler Host: localhost Content-Length: 34
User-Agent: Fiddler Content-Type: application/x-www-form-urlencoded Host: localhost Content-Length: 34
而後咱們在request body裏都這麼寫post串,服務端就能夠接收post值了segmentfault
city='dfdafdsfsaf'&mm="1232323123"
User-Agent: Fiddler Content-Type: application/json Host: localhost
requset body裏就這麼寫app
{ "city": "dfdafdsfsaf", "mm": "1232323123" }
能夠接收,但通常咱們都是接收一個表單元素裏放一些咱們自定義後的數據。post
在Http中,POST參數的請求格式是由Content-type選項控制的。比較常見兩種Content-type選項和數據格式我用下表列出:url
稍做修改,轉自:https://segmentfault.com/a/1190000007488357 @牙小木木
spa