【发布时间】:2021-01-10 11:25:14
【问题描述】:
我正在使用 Postman 测试一个 grpc 端点。我在 header Content-Type: application/json 中设置,然后在 body 中,我选择了 raw,JSON。
但是,我不断收到 500 Internal Server Error,详细信息是:
[grpc-default-executor-1] 错误 me.dinowernli.grpc.polyglot.io.LoggingStatsWriter - 由于错误 io.grpc.StatusRuntimeException 中止 rpc:不可用:HTTP 状态代码 502 无效内容类型:文本/纯文本.
更奇怪的是,当我检查响应的 Headers 时,它显示 Content-Type 为 text/plain; charset=utf-8,也就是说我设置的 Content-Type: application/json 没有被应用。
有什么想法吗?
【问题讨论】:
-
响应的内容类型就是:你返回的响应的类型,确实是纯txt(错误信息),而不是JSON。
-
谢谢,克里斯蒂安!知道我应该如何解决这个错误吗? @ChristianBaumann
标签: postman grpc content-type