How to Put DateTime in Body POSTMAN

那年仲夏 提交于 2021-01-29 21:23:06

问题


I tried this one but didnt work for me.
I got NULL value of "date_creation" in DB (Mysql)


I used Pre-request script tab to save the date into a variable:

var current_timestamp = new Date();
postman.setEnvironmentVariable("current_timestamp", current_timestamp.toISOString());

{
    "rib": "123456789",
    "code_client": "3",
    "taux":"19",
    "decouvert" : "150",
    "solde" : "8500",
    "date_creation" : "{{current_timestamp}}"
    
}

回答1:


You have to select Raw and type JSON for request body

You can check what was send to database by opening console view>show postman console

and then click the request>request body in the console

WHich shows what was actually send to server.

If its still failing then its not issue with postman but your application



来源:https://stackoverflow.com/questions/64893960/how-to-put-datetime-in-body-postman

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!