gpt4 book ai didi

api - HTTP 状态代码 >= 300 返回 JSON

转载 作者:可可西里 更新时间:2023-11-01 16:33:19 25 4
gpt4 key购买 nike

我想知道让服务器返回 JSON 响应以及 3xx 或 4xx 响应是否可以接受/常见?

我问这个的原因是因为我确实返回了一个 JSON 响应,其中包含有关错误的更多详细信息,但是 it seems the engine I am using doesn't agree with what I am doing .在提交 PR 之前,我想确保我的方法是可以接受的。

最佳答案

3xx 或 4xx 响应具有正文实体是完全可以的,有时甚至是必需的。

例如,对于 300 Multiple Choices :

Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate.

关于api - HTTP 状态代码 >= 300 返回 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28662167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com