问题描述
我无法让POSTMAN将任何帖子变量发送到我的Django应用程序。假设我有一个名为'report_request'的post变量,它的值是一个JSON字符串。在Django方面,我想获取request.POST ['report_request']并将JSON解析为字典。但POSTMAN似乎永远不会发送POST数据。我到底该怎么做?我需要发送一些神奇的标题吗?
I can't get POSTMAN to send any post variables to my Django app. Suppose I have a post variable called 'report_request' and it has a value that is a JSON string. On the Django side I want to get request.POST['report_request'] and parse the JSON into a dictionary. But POSTMAN never seems to send the POST data. How exactly do I do this? Is there some magical header I need to send?
推荐答案
Doh!我的错。我需要连接的URL实际上是HTTPS而不是HTTP,但我将URL指定为http://。显然,如果要求邮递员使用HTTP连接到HTTPS站点,它会默默地删除所有POST变量。多么可爱。无论如何,这是一个简单的修复,只需将http:// url更改为https://,一切顺利。
Doh! My bad. The URL I need to connect to is really HTTPS rather than HTTP, but I was specifying the URL as http://. Apparently if Postman is asked to connect to an HTTPS site using HTTP, it silently just drops all POST variables. How lovely. Anyway it was an easy fix, just change the http:// url to https:// and all is well.
这篇关于如何在POSTMAN中发送POST变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!