Json Swagger UI在响应正文中返回“无内容”,响应代码为0
我是新来的大摇大摆的用户界面。我将swagger与Json结合使用。当响应也是Json时。单击“尝试”时,我看到一个正确的请求URL,但Swagger UI在响应正文中不返回任何内容,响应代码为0 提到API的URL不可公开访问,但承载Swagger UI的站点与承载API的站点位于同一网络中 我看到堆栈溢出问题,但没有找到解决方案 我的Swagger.Json文件: 请任何人帮忙。Json Swagger UI在响应正文中返回“无内容”,响应代码为0,json,swagger,swagger-ui,Json,Swagger,Swagger Ui,我是新来的大摇大摆的用户界面。我将swagger与Json结合使用。当响应也是Json时。单击“尝试”时,我看到一个正确的请求URL,但Swagger UI在响应正文中不返回任何内容,响应代码为0 提到API的URL不可公开访问,但承载Swagger UI的站点与承载API的站点位于同一网络中 我看到堆栈溢出问题,但没有找到解决方案 我的Swagger.Json文件: 请任何人帮忙。 提前感谢。这应该是CORS的问题。您应该将访问控制允许源代码:*添加到响应标题中 请参阅:您能否打开浏览器调试控
提前感谢。这应该是CORS的问题。您应该将访问控制允许源代码:*添加到响应标题中
请参阅:您能否打开浏览器调试控制台并共享其中显示的任何错误?是否有任何解决方案。我也面临同样的问题
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger for Rest API",
"description": "A sample API that uses a application as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "Swagger API team",
"email": "abc@gmail.com",
"url": "http://xxxx.com"
},
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
},
"host": "localhost:85xx",
"basePath": "/v1",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/test/{username}/{albumname}/{imagename}": {
"get": {
"description": "Returns all images from the system that the user has access to",
"operationId": "findface",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"name": "username",
"in": "path",
"description": "tags to filter by",
"required": true,
"type": "string"
},
{
"name": "albumname",
"in": "path",
"description": "maximum number of results to return",
"required": true,
"type": "string"
},
{
"name": "imagename",
"in": "path",
"description": "maximum number of results to return",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/test1"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
}
},
"definitions": {
"test1": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"errorModel": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}