SN-1586 已核对来源,附原文与上下文。
显然,重复头部是个 bug。
Obviously it's a bug that it repeats the header.
我当时是想遵循 1.0 规范:http://json-rpc.org/wiki/specification 它要求支持 multiple invocation。
I was trying to follow the 1.0 spec: http://json-rpc.org/wiki/specification It called for multiple invocation.
我想他们的意思是下面这样,但不确定:
I think they mean it's like this, but I'm not sure:
Post:
Post:
{"method": "postMessage", "params": ["Hello all!"], "id": 99}
{"method": "postMessage", "params": ["Hello all!"], "id": 99}
{"method": "postMessage", "params": ["I have a question:"], "id": 101}
{"method": "postMessage", "params": ["I have a question:"], "id": 101}
Reply:
Reply:
{"result": 1, "error": null, "id": 99}
{"result": 1, "error": null, "id": 99}
{"result": 1, "error": null, "id": 101}
{"result": 1, "error": null, "id": 101}
我不记得在哪看到过错误回复应返回 HTTP 状态 500。如果回复里含多个响应且其中一个是错误,我猜整个的状态就是 500。也许应该一律返回 200。我记得有人说 500 可能导致了问题。
I can't remember where I think I saw that it's supposed to send back HTTP status 500 for an error reply. If it contains multiple responses and one is an error, I wonder if that makes the status 500 for the whole thing, I guess so. Maybe it should always return 200. I think someone sounded like the 500 might be causing a problem.
这个多半要等 0.3.3 之后修。在那之前,只用单调用。我不知道有没有哪个 JSON-RPC 包真的支持 multiple invocation,多半没有。
This probably gets fixed after 0.3.3. Until then, just use single invocation. I wonder if any JSON-RPC package even supports multiple invocation, probably not.
最好先弄清楚 multiple-invocation 到底应该怎么工作(如果真该支持的话),以及错误响应返回 HTTP 500 是否正确,再去修它。
It would be nice if we could pin down better how multiple-invocation is supposed to work, if at all, before trying to fix it, and whether returning HTTP status 500 for error response is right.