我目前正在学习 Mulesoft Mule 4 基础课程,并在 Runtime Manager 上部署了一个应用程序。
当我在运行时管理器上查看我的应用程序日志和 Anypoint Studio 的日志时,我在测试 GET HTTP 请求时看到上述“不支持的媒体类型”错误。在 ARC 中进行测试时,我也会收到此错误。
当我查看 Mule 调试器,然后查看 Anypoint Studio 中的有效负载时,我看到了mediaType = */* charset = UTF-8
我认为这不需要为 GET 请求添加,那么我该如何解决呢?
我的 RAML 文件:
#%RAML 1.0
title: session-2
types:
newsProperties: !include schemas/newsDataType.raml
/search:
get:
headers:
Accept:
default: application/json
queryParameters:
keyword:
type: string
minLength: 3
maxLength: 10
responses:
200:
body:
application/json:
example: !include examples/searchExample.raml
400:
body:
application/json:
example:
{"message": "Search query too long"}
/news:
post:
queryParameters:
country:
required: false
body:
application/json:
type: newsProperties
responses:
201:
body:
application/json:
example: !include examples/searchExample.raml
/sportsNews:
put:
body:
application/json:
type: newsProperties
在网上搜索并尝试了许多我见过的不同解决方案后,最近添加了 /search 资源 GET 方法中的标题,但我仍然遇到相同的错误。任何帮助,将不胜感激。
谢谢!