简体   繁体   中英

cannot get req.body property from http post method

I have a http post request which I'm not able to get the params from. This is posted to an express application. I can inspect the request body not req.body.sign. For testing I'm using a curl command but even w/ simplified version, I'm unable to access payResult. Is there an issue w/ curl options ? Is the object formatted poorly, any help would be appreciated.

curl --header 'Content-Type: application/x-www-form-urlencoded' --request POST --data '{ sign: '68FF103130163F52A2B8178F73BFAB2CE322A4F5EB48DECD11FFE75AF2E2F3803CD07DBAB1F311700077EEC184463173F6773F059BD5783E61B7F04CBB80C9E333DABA2066774F2BEDB53EA6243B6FA40ADC2700A4C75EEDE700ABF493B60D9D62175C50774782ED6F10323A389DB04E29009572323EC1FAFCEB34D204CECD90', body: '{"payResult":"SUCCESS"}' }' https://somedomain.com/notifyUrl/

将Content-Type:application / x-www-form-urlencoded替换为Content-Type:application / json,因为您发布了json数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM