如何将日期时间放入正文 POSTMAN [英] How to Put DateTime in Body POSTMAN

查看:15
本文介绍了如何将日期时间放入正文 POSTMAN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过这个,但对我没有用.
我得到了date_creation"的 NULL 值.在数据库(Mysql)中

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}}"
    
}

推荐答案

您必须选择 Raw 并为请求正文键入 JSON

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

WH 显示实际发送到服务器的内容.

WHich shows what was actually send to server.

如果它仍然失败,那么它不是邮递员的问题,而是你的应用程序

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

这篇关于如何将日期时间放入正文 POSTMAN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆