Swagger 吐出 xml 响应而不是 json [英] Swagger spitting out xml response instead of json

查看:70
本文介绍了Swagger 吐出 xml 响应而不是 json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在春天出生一周.我正在使用 Spring + maven + Jackson 开发一个纯 RESTful API 服务.在探索一些最佳实践时,我遇到了这个,所以我决定我将使用 swagger 和 spring mvc(和 swaggerUI)作为文档.我经历了this这个 做我想做的事情的教程.一切都很顺利,直到我意识到在点击/api-docs 后我得到了 XML 响应,而不是教程和其他地方的 JSON 响应.当我添加 SwaggerUI 时,这将无法正常工作.后来我发现 here swaggerUI 需要 json.我总是可以在没有服务器集成的情况下返回并使用 swagger (https://github.com/wordnik/swagger-core/wiki/Adding-Swagger-to-your-API),但这并不能真正满足我的需求.

这里是 pom.xml 的内容:

<modelVersion>4.0.0</modelVersion><groupId>com.darshandzend</groupId><artifactId>swjs</artifactId><name>swjs</name><包装>战争</包装><version>1.0.0-BUILD-SNAPSHOT</version><属性><java-version>1.6</java-version><org.springframework-version>3.1.1.RELEASE</org.springframework-version><org.aspectj-version>1.6.10</org.aspectj-version><org.slf4j-version>1.6.6</org.slf4j-version></属性><依赖项><!-- 春天 --><依赖><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${org.springframework-version}</version><排除事项><!-- 排除 Commons Logging 以支持 SLF4j --><排除><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></排除></排除项></依赖><依赖><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${org.springframework-version}</version></依赖><!-- AspectJ --><依赖><groupId>org.aspectj</groupId><artifactId>aspectjrt</artifactId><version>${org.aspectj-version}</version></依赖><!-- 日志记录--><依赖><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>${org.slf4j-version}</version></依赖><依赖><groupId>org.slf4j</groupId><artifactId>jcl-over-slf4j</artifactId><version>${org.slf4j-version}</version><scope>运行时</scope></依赖><依赖><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>${org.slf4j-version}</version><scope>运行时</scope></依赖><依赖><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.15</version><排除事项><排除><groupId>javax.mail</groupId><artifactId>邮件</artifactId></排除><排除><groupId>javax.jms</groupId><artifactId>jms</artifactId></排除><排除><groupId>com.sun.jdmk</groupId><artifactId>jmxtools</artifactId></排除><排除><groupId>com.sun.jmx</groupId><artifactId>jmxri</artifactId></排除></排除项><scope>运行时</scope></依赖><!-- @Inject --><依赖><groupId>javax.inject</groupId><artifactId>javax.inject</artifactId><版本>1</版本></依赖><!-- Servlet --><依赖><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><范围>提供</范围></依赖><依赖><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1</version><范围>提供</范围></依赖><依赖><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></依赖><!-- 测试--><依赖><groupId>junit</groupId><artifactId>junit</artifactId><version>4.7</version><范围>测试</范围></依赖><依赖><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>1.9.13</version></依赖><依赖><groupId>com.wordnik</groupId><artifactId>swagger-core</artifactId><version>1.1-SNAPSHOT.121130</version></依赖><依赖><groupId>com.mangofactory</groupId><artifactId>swagger-springmvc</artifactId><version>0.6.3</version></依赖></依赖项><构建><插件><插件><artifactId>maven-eclipse-plugin</artifactId><version>2.9</version><配置><附加项目性质><projectnature>org.springframework.ide.eclipse.core.springnature</projectnature></additionalProjectnatures><其他构建命令><buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand></additionalBuildcommands><down​​loadSources>true</downloadSources><down​​loadJavadocs>true</downloadJavadocs></配置></插件><插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.5.1</version><配置><来源>1.6</来源><目标>1.6</目标><compilerArgument>-Xlint:all</compilerArgument><showWarnings>true</showWarnings><showDeprecation>true</showDeprecation></配置></插件><插件><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>1.2.1</version><配置><mainClass>org.test.int1.Main</mainClass></配置></插件></plugins></build>

servlet 上下文:

<!-- 启用 Spring MVC @Controller 编程模型 --><注解驱动/><!-- 通过高效服务处理/resources/** 的 HTTP GET 请求上传 ${webappRoot}/resources 目录中的静态资源 --><resources mapping="/resources/**" location="/resources/"/><!-- 将@Controllers 选择渲染的视图解析为 .jsp 资源在/WEB-INF/views 目录中 --><豆类:豆类class="org.springframework.web.servlet.view.InternalResourceViewResolver"><beans:property name="prefix" value="/WEB-INF/views/"/><beans:property name="suffix" value=".jsp"/></beans:bean><context:component-scan base-package="com.darshandzend.swjs"/><beans:bean class="com.mangofactory.swagger.configuration.DocumentationConfig"/><context:property-placeholder location="classpath:/swagger.properties"/>

swagger.properties

documentation.services.version=1.0documentation.services.basePath=http://localhost:8080/swjs/

我在 chrome dev http 工具中尝试了 GET/api-docs/,并将Accept"标头设置为application/json",结果奏效了.这是否意味着我必须手动设置请求标头?我添加 web.xml 以防万一.

web.xml:

<!-- 所有Servlets和Filters共享的Root Spring Container的定义--><上下文参数><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/spring/root-context.xml</param-value></context-param><!-- 创建所有 Servlet 和过滤器共享的 Spring Container --><监听器><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></监听器><!-- 处理应用请求--><小服务程序><servlet-name>appServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value></init-param><启动时加载>1</启动时加载><servlet-mapping><servlet-name>appServlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping>

我认为 swagger 不需要任何特殊的注释,所以我的 java 代码库保持不变.

这个问题是不是太长了?原谅我,因为我是新来的.请编辑并提出建议.

控制器类:

@Api(value = "contacts", description = "contacts")//Swagger注解@控制器@RequestMapping("/home")公共类 HomeController {@ResponseBody@RequestMapping(方法=RequestMethod.GET)公共响应选择(){return new Response("success", "", "这是万物的卑微居所");}@ResponseBody@RequestMapping(value="/{id}",method=RequestMethod.GET)公共响应获取(@PathVariable 字符串 ID){return new Response("成功", "", id);}}

解决方案

Swagger-ui 没有为其 AJAX 请求设置 Accept 标头.不幸的是,如果没有接受头或没有给出路径扩展名 (.json),swagger-springmvc 会返回 XML.

您可以为 swagger-ui 执行的每个请求手动添加 JSON 接受标头.只需将以下 JavaScript 行添加到您的 swagger-ui index.html 文件中:

window.authorizations.add("Accept",new ApiKeyAuthorization("Accept", "application/json", "header"));

这是我修改后的 index.html 文件:

<头><title>Swagger UI</title><link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/><link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/><link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/><script type="text/javascript" src="lib/shred.bundle.js"></script><script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script><script src='lib/jquery.slideto.min.js' type='text/javascript'></script><script src='lib/jquery.wiggle.min.js' type='text/javascript'></script><script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script><script src='lib/handlebars-1.0.0.js' type='text/javascript'></script><script src='lib/underscore-min.js' type='text/javascript'></script><script src='lib/backbone-min.js' type='text/javascript'></script><script src='lib/swagger.js' type='text/javascript'></script><script src='swagger-ui.js' type='text/javascript'></script><script src='lib/highlight.7.3.pack.js' type='text/javascript'></script><script type="text/javascript">$(函数(){window.swaggerUi = 新 SwaggerUi({url: "http://localhost:8080/api-docs",dom_id: "swagger-ui-container",支持提交方法: ['get', 'post', 'put', 'delete'],onComplete:函数(swaggerApi,swaggerUi){如果(控制台){console.log("加载 SwaggerUI")}$('pre code').each(function(i, e) {hljs.highlightBlock(e)});},onFailure:功能(数据){如果(控制台){console.log("无法加载 SwaggerUI");控制台日志(数据);}},文档扩展:无"});window.authorizations.add("Accept", new ApiKeyAuthorization("Accept", "application/json", "header"));$('#input_apiKey').change(function() {var key = $('#input_apiKey')[0].value;console.log("key: " + key);if(key && key.trim() != "") {console.log("添加密钥" + key);window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));}})window.swaggerUi.load();});<身体><div id='header'><div class="swagger-ui-wrap"><a id="logo" href="http://swagger.wordnik.com">swagger</a><form id='api_selector'>

<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example APIs">

<div class='input icon-btn'><img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer APIs">

<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div><div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div><div class='input'><a id="explore" href="#">Explore</a></div></表单>

<div id="message-bar" class="swagger-ui-wrap">&nbsp;

<div id="swagger-ui-container" class="swagger-ui-wrap">

</html>

I'm a week old in spring. I'm developing a pure RESTful API service using Spring + maven + Jackson. While exploring some best practices, I came across this, so I decided I'll be using swagger with spring mvc (and swaggerUI) for documentation. I went through this and this tutorial for doing what I wanted. Everything was going fine and dandy until I realized after hitting /api-docs I got XML response, as opposed to JSON response in tutorials and every-other-where. This won't work fine when I add SwaggerUI. Later I found out here that swaggerUI expects json. I could always go back and use swagger without server integration (https://github.com/wordnik/swagger-core/wiki/Adding-Swagger-to-your-API), but that won't really satisfy my needs.

Here are the contents of pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.darshandzend</groupId>
<artifactId>swjs</artifactId>
<name>swjs</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
    <java-version>1.6</java-version>
    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.aspectj-version>1.6.10</org.aspectj-version>
    <org.slf4j-version>1.6.6</org.slf4j-version>
</properties>
<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>

    <!-- AspectJ -->
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>${org.aspectj-version}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <exclusions>
            <exclusion>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
        </exclusions>
        <scope>runtime</scope>
    </dependency>

    <!-- @Inject -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>
    <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-core</artifactId>
        <version>1.1-SNAPSHOT.121130</version>
    </dependency>

    <dependency>
        <groupId>com.mangofactory</groupId>
        <artifactId>swagger-springmvc</artifactId>
        <version>0.6.3</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                </additionalProjectnatures>
                <additionalBuildcommands>
                    <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                </additionalBuildcommands>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <mainClass>org.test.int1.Main</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

servlet context:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<!-- DispatcherServlet Context: defines this servlet's request-processing 
    infrastructure -->

<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />

<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
    up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

<!-- Resolves views selected for rendering by @Controllers to .jsp resources 
    in the /WEB-INF/views directory -->
<beans:bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="prefix" value="/WEB-INF/views/" />
    <beans:property name="suffix" value=".jsp" />
</beans:bean>

<context:component-scan base-package="com.darshandzend.swjs" />

<beans:bean class="com.mangofactory.swagger.configuration.DocumentationConfig" />
<context:property-placeholder location="classpath:/swagger.properties" />

swagger.properties

documentation.services.version=1.0
documentation.services.basePath=http://localhost:8080/swjs/

I tried GET /api-docs/ in chrome dev http tool with "Accept" header set to "application/json", which worked. Does this mean I manually have to set request headers somewhre? I'm adding web.xml just in case.

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>

<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- Processes application requests -->
<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

I reckon swagger won't require any special annotations so my java codebase remains the same.

Is this question too long? Pardon me, for I'm new to SO. Please edit and suggest.

Controller class:

@Api(value = "contacts", description = "contacts") // Swagger annotation
@Controller
@RequestMapping("/home")
public class HomeController {
@ResponseBody
  @RequestMapping(method=RequestMethod.GET)
  public Response select() {
    return new Response("success", "", "this is the humble abode of everything");
  }

@ResponseBody
  @RequestMapping(value="/{id}",method=RequestMethod.GET)
  public Response get(@PathVariable String id) {
    return new Response("Success", "", id);
  }
}

解决方案

Swagger-ui does not set an Accept header with its AJAX requests. Unfortunately swagger-springmvc returns XML if no accept header or no path extension (.json) is given.

You can manually add a JSON accept header to every request swagger-ui executes. Simply add the following JavaScript line to your swagger-ui index.html file:

window.authorizations.add("Accept", 
    new ApiKeyAuthorization("Accept", "application/json", "header"));

This is my modified index.html file:

<!DOCTYPE html>
<html>
<head>
  <title>Swagger UI</title>
  <link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
  <link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
  <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
  <script type="text/javascript" src="lib/shred.bundle.js"></script>
  <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
  <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
  <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
  <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
  <script src='lib/handlebars-1.0.0.js' type='text/javascript'></script>
  <script src='lib/underscore-min.js' type='text/javascript'></script>
  <script src='lib/backbone-min.js' type='text/javascript'></script>
  <script src='lib/swagger.js' type='text/javascript'></script>
  <script src='swagger-ui.js' type='text/javascript'></script>
  <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
  <script type="text/javascript">
    $(function () {
      window.swaggerUi = new SwaggerUi({
      url: "http://localhost:8080/api-docs",
      dom_id: "swagger-ui-container",
      supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
      onComplete: function(swaggerApi, swaggerUi){
        if(console) {
          console.log("Loaded SwaggerUI")
        }
        $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
      },
      onFailure: function(data) {
        if(console) {
          console.log("Unable to Load SwaggerUI");
          console.log(data);
        }
      },
      docExpansion: "none"
    });

    window.authorizations.add("Accept", new ApiKeyAuthorization("Accept", "application/json", "header"));

    $('#input_apiKey').change(function() {
      var key = $('#input_apiKey')[0].value;
      console.log("key: " + key);
      if(key && key.trim() != "") {
        console.log("added key " + key);
        window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
      }
    })
    window.swaggerUi.load();
  });

  </script>
</head>

<body>
<div id='header'>
  <div class="swagger-ui-wrap">
    <a id="logo" href="http://swagger.wordnik.com">swagger</a>

    <form id='api_selector'>
      <div class='input icon-btn'>
        <img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
      </div>
      <div class='input icon-btn'>
        <img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer Apis">
      </div>
      <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
      <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
      <div class='input'><a id="explore" href="#">Explore</a></div>
    </form>
  </div>
</div>

<div id="message-bar" class="swagger-ui-wrap">
  &nbsp;
</div>

<div id="swagger-ui-container" class="swagger-ui-wrap">

</div>

</body>

</html>

这篇关于Swagger 吐出 xml 响应而不是 json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆