0
的HTTP預覽:的bodyParser不工作的時候交的「表單數據」與郵差
POST /kflq_webcfg/v1/update HTTP/1.1
Host: h.innmall.cn
Cache-Control: no-cache
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="data"
{"orderInnerId":"12146","p":{"imei":"866568022978356","mac":"58:1f:28:ea:4d:e1","os":"android4.4.2","platform":"Android","ptype":"H60-L01_19_4.4.2","version":"6.1.1"},"type":1}
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="mode"
plain
----WebKitFormBoundaryE19zNvXGzXaLvS5C
但可以解析器的X WWW的形式進行urlencode:
POST /kflq_webcfg/v1/update HTTP/1.1
Host: h.innmall.cn
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
data={"orderInnerId":"12146","p":{"imei":"866568022978356","mac":"58:1f:28:ea:4d:e1","os":"android4.4.2","platform":"Android","ptype":"H60-L01_19_4.4.2","version":"6.1.1"},"type":1}&mode=plain
如何解決這個問題通過body-parser中間件?
我需要這兩種情況才能得到相同的結果。
非常感謝你!
郵差可以導出各種格式的HTTP請求 - 你確定你是以最好的格式導出你的需求嗎? – Eilidh
@Eilidh我想兼容兩種情況... –
如何設置bodyparser? –