【发布时间】:2015-04-28 12:53:45
【问题描述】:
我正在尝试通过 REST API 将文件附加到 Asana 中的任务,但出现超时错误。我相信错误来自 Asana 方面,所以我有点卡住了......
我提出的请求格式如下
POST https://app.asana.com/api/1.0/tasks/<my task>/attachments HTTP/1.1
User-Agent: OutSystemsPlatform
Content-Type: multipart/form-data; boundary="<my boundary>"
Authorization: Bearer <my bearer>
Host: app.asana.com
Content-Length: 218
--<my boundary>
content-disposition: multipart/form-data; name=file; filename=<my filename>;
content-type: image/jpeg
<file binary data>
--<my boundary>--
我得到的回复如下
HTTP/1.1 504 Gateway Time-out
Connection: keep-alive
Content-Length: 176
Content-Type: text/html
Date: Tue, 28 Apr 2015 11:36:03 GMT
Server: nginx
<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>
在我看来,请求的格式很好,但它不起作用。
有人可以帮忙吗?
谢谢 佩德罗·卡多索
【问题讨论】:
-
我目前正在调查生成此 504 的场景。我怀疑请求实际上有点偏离,我们在解析它时遇到了问题,但我不确定具体出了什么问题。你想用什么语言来做这个?您是否使用任何库来构建请求?
-
我正在使用 OutSystems 平台。如果您不知道,请访问 www.outsystems.com。基本上,这会生成一个运行此请求的 .Net 应用程序。我在这里粘贴的请求就是我在日志中看到的。为什么说请求有点偏?
-
您能否测试一下您在请求中使用了哪些换行符?你可以read here。 HTTP 规范是使用
\r\n换行。如果使用\n格式不正确的 multipart/form-data 请求,我们的服务器将生成 5xx。