Oracle REST数据服务,JSON vs HTML错误响应
我有一个带有Post方法的REST API,它可以正常工作。但是在自定义400状态代码错误响应中,内容类型似乎是HTML而不是JSON。
样本:
400,79ms,23个字节
API_STATUS_CODE:SIM400-05 连接:关闭 content-type:文本/html ; charset = utf-8 日期:2022年6月13日星期一14:31:15 GMT 转移编码:块 X-ords_debug:错误
无效帐号
我尝试在我的请求标题中添加“ REST-FRAMEWORK-REVER”为4,但错误响应仍然是HTML而不是JSON。
Oracle Apex:21.1 Oracle Ords:21
I have a REST API with POST method and it works fine. But on a custom 400 status code error response the content-type seems to be html rather than json.
Sample:
400 , 79ms, 23 bytes
api_status_code: SIM400-05
connection: close
content-type: text/html;charset=UTF-8
date: Mon, 13 Jun 2022 14:31:15 GMT
transfer-encoding: chunked
x-ords_debug: false
Invalid Account Number
I have tried adding "REST-Framework-Version" as 4 in my request header but still the error response is as html and not json.
Oracle APEX: 21.1
Oracle ORDS: 21
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的要求中包括一个接受标头。
In your request include an Accept header.
在打印响应消息
owa_util.mime_header('application/json')之前,请在PLSQL代码中添加下面的标题。
Add below header in PLSQL code before printing the response message
OWA_UTIL.mime_header('application/json');