ios - 谷歌应用引擎。 Google 应用引擎将 POST 请求视为 GET
<p><p>我现在遇到了谷歌应用引擎最奇怪的问题。我从 iOS 发送一个 POST 请求,而谷歌应用引擎调用了 GET 处理程序。</p>
<p>我已将这种情况沙盒化以进行测试,但无法弄清楚。我有一个只发送请求的 iOS 应用程序。除了服务之外,我已经评论了 GAE 上的所有内容。该服务只记录一个参数并返回。</p>
<p>我尝试过使用两种不同方式发送请求的 iOS 应用。两者都不起作用。</p>
<p>iOS 代码:</p>
<pre><code>/*
NSURL * url = ;
ASIFormDataRequest * _fdrequest = [ initWithURL:url];
;
;
*/
NSURL * __url = ;
NSMutableURLRequest * __request = ;
;
NSString * post = ;
];
;
</code></pre>
<p>我的应用引擎处理程序:</p>
<pre><code>class TestParameter(webapp.RequestHandler):
def post(self):
logging.debug(self.request.get("testkey"))
self.response.out.write(self.request.get("testkey"))
print self.request.get("testkey")
def get(self):
logging.debug("get")
logging.debug(self.request.get("testkey"))
self.response.out.write(self.request.get("testkey"))
</code></pre>
<p>GAE 日志中的输出显示“get”代码路径不正确。</p>
<p>知道为什么 POST 请求会以 GET 形式进入 GAE 吗?我错过了 GAE 中的某些配置吗?</p>
<p>谢谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>检查 app.yaml 中处理“/TestParameter”的脚本的条目。它是否指定“安全:始终”?如果是这样并且您进行了非安全连接,您将获得 302 重定向到安全版本。</p>
<p>要解决此问题,请通过 HTTPS 发布您的帖子,或从 app.yaml 中的条目中删除“安全:始终”。</p></p>
<p style="font-size: 20px;">关于ios - 谷歌应用引擎。 Google 应用引擎将 POST 请求视为 GET,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/8411185/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/8411185/
</a>
</p>
页:
[1]