英文:
wso2 api manager GW 101504 error Connection timed out (no input was detected on this connection) that leads to SUSPENDED state of wso2 after recall
问题
如果您调用一个API,将头部设置为application/json并将请求体设置为空,则下面是curl请求:
curl --location \
'https://10.10.20.10:8243/api/test/v1/test' \
--header 'Id: 100' \
--header 'channel: WEB' \
--header 'code: 0011111111' \
--header 'Content-Type: application/json' \
--header 'Cookie: cookiesession1=2A041602JFUID8V8GGVYYBDQG3XTF11A' \
--data ''
API网关会等待一段默认时间来接收输入,如果在最大不活动期间没有检测到输入,将返回101504错误代码。如果您想要一次性检查请求体是否为空并发送适当的错误,可以使用以下方法来检查:
if [ -z "$(<your_request_body_variable>)" ]; then
echo "Request body is empty. Sending appropriate error..."
# Add code here to handle the error response.
fi
请将<your_request_body_variable>
替换为实际的请求体变量名称。这个脚本片段会检查请求体是否为空,并在需要时发送适当的错误响应。
英文:
if you call an API with header being set to application/json and body sent null.below is curl request :
curl --location
'https://10.10.20.10:8243/api/test/v1/test
--header 'Id: 100' \
--header 'channel: WEB' \
--header 'code: 0011111111' \
--header 'Content-Type: application/json' \
--header 'Cookie: cookiesession1=2A041602JFUID8V8GGVYYBDQG3XTF11A' \
--data ''
the API gateway waits a default time for an Input and if no input was detected connection over the maximum period of inactivity returns 101504 error code.if you send a request another time is will be suspended and It is a big issue for our use case , how to check if body was empty at once send appropriate error?
答案1
得分: 1
这种行为可能是因为 WSO2 API 管理器网关期望在 POST 或 PUT 请求中包含请求有效负载。
您可以按照此 文档链接 关闭此行为。FORCE_POST_PUT_NOBODY
Synapse 属性可以配置 API 管理器在进行 PUT 或 POST 请求时,如果没有有效负载,则无需等待任何请求有效负载。
英文:
This behaviour might be because the WSO2 API Manager Gateway is expecting a Request Payload in the POST or PUT Request.
You can follow this documentation to disable this behaviour. The FORCE_POST_PUT_NOBODY
synapse property can configure the API Manager not to wait for any Request Payloads when a PUT or POST Request is made without any payload.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论