204 错误代码然后 500 错误代码响应
204 error code then 500 error code responses
所以我有一个应用程序需要将数据发送到 API,它是由我们的团队领导使用 NodeJS 和 Express.js 创建的。
在我这边,我有 laravel 应用程序,它使用 VueJS 作为 UI。在 Vue JS 组件内部。我正在使用 axios 请求 API。
axios.post('https://clearkey-api.mybluemix.net/sendcampaign', request)
.then(function(response) {
//console.log(response);
})
然而,它returns 204 这意味着根据这个https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html。
204 No Content
The server has fulfilled the request but does not need to return an
entity-body, and might want to return updated metainformation. The
response MAY include new or updated metainformation in the form of
entity-headers, which if present SHOULD be associated with the
requested variant.
If the client is a user agent, it SHOULD NOT change its document view
from that which caused the request to be sent. This response is
primarily intended to allow input for actions to take place without
causing a change to the user agent's active document view, although
any new or updated metainformation SHOULD be applied to the document
currently in the user agent's active view.
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
然后是 returns 500 内部服务器错误。所以在我看来,return 是因为没有要从服务器 return 编辑的内容?
你能告诉我其他可能的问题吗 return 为什么会有这样的反应?
检查204的"HTTP method"是否为OPTIONS
,500的方法是否为POST
。
如果两者都是这样,那么您首先看到的是 CORS pre-flight request(returns 204 的 OPTIONS
),然后是实际请求(POST
returns 500).
CORS 飞行前请求是当网页和后端托管在不同地址时,您的浏览器向服务器发送的特殊 HTTP 消息。例如,如果您的网站托管在 http://localhost
,但您尝试访问的后端托管在 https://clearkey-api.mybluemix.net
。
204 的原因仅表示您的后端端点已正确设置为处理 /sendcampaign
的请求(您可以忽略它)。 500 的原因是因为在处理该端点的函数的实现中出现了一些异常。
所以我有一个应用程序需要将数据发送到 API,它是由我们的团队领导使用 NodeJS 和 Express.js 创建的。
在我这边,我有 laravel 应用程序,它使用 VueJS 作为 UI。在 Vue JS 组件内部。我正在使用 axios 请求 API。
axios.post('https://clearkey-api.mybluemix.net/sendcampaign', request)
.then(function(response) {
//console.log(response);
})
然而,它returns 204 这意味着根据这个https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html。
204 No Content
The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant.
If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view.
The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.
然后是 returns 500 内部服务器错误。所以在我看来,return 是因为没有要从服务器 return 编辑的内容?
你能告诉我其他可能的问题吗 return 为什么会有这样的反应?
检查204的"HTTP method"是否为OPTIONS
,500的方法是否为POST
。
如果两者都是这样,那么您首先看到的是 CORS pre-flight request(returns 204 的 OPTIONS
),然后是实际请求(POST
returns 500).
CORS 飞行前请求是当网页和后端托管在不同地址时,您的浏览器向服务器发送的特殊 HTTP 消息。例如,如果您的网站托管在 http://localhost
,但您尝试访问的后端托管在 https://clearkey-api.mybluemix.net
。
204 的原因仅表示您的后端端点已正确设置为处理 /sendcampaign
的请求(您可以忽略它)。 500 的原因是因为在处理该端点的函数的实现中出现了一些异常。