可能是由于API网关配置或权限设置等原因导致GET请求被禁止并返回了403状态码以及HTML内容。如果需要获取正确的数据内容,可以尝试以下
检查API网关的配置和权限设置,确保GET请求可以被访问并返回所需的数据。
如果需要返回JSON或其他格式的数据,可以在API网关中设置返回格式。例如,以下是在AWS API网关中将返回内容设置为JSON格式的示例代码:
{
"swagger": "2.0",
"info": {
"title": "Example API",
"version": "1.0.0"
},
"basePath": "/",
"schemes": [
"https"
],
"produces": [
"application/json"
],
"paths": {
"/example": {
"get": {
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful response",
"schema": {
"type": "object"
},
"headers": {
"Content-Type": {
"type": "string",
"description": "Response content type",
"default": "application/json"
}
}
}
}
}
}
}
}