Swagger 3.0 - 未为表单数据参数标识ContentType

时间:2018-02-11 05:53:12

标签: java spring rest annotations swagger

我正在使用Swagger 3.0,在提交带有来自swagger UI的表单参数的api时,请求将在没有

的情况下发送
ContentType:application/x-www-form-urlencoded

由于这个原因,低于例外。

我可以从GitHub看到一个与此相关的问题。但不确定,它仍然是开放的还是固定的。

https://github.com/swagger-api/swagger-ui/issues/3583

Swagger版本:swagger-annotations-2.0.0-rc4和rc3

例外:

11-Feb-2018 10:14:50.637 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [userRestApplicationJersey] in context with path [] threw exception 
[java.lang.IllegalStateException: The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded] with root cause
java.lang.IllegalStateException: The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded
at org.glassfish.jersey.server.internal.inject.FormParamValueParamProvider$FormParamValueProvider.ensureValidRequest(FormParamValueParamProvider.java:131)
at org.glassfish.jersey.server.internal.inject.FormParamValueParamProvider$FormParamValueProvider.getForm(FormParamValueParamProvider.java:205)
at org.glassfish.jersey.server.internal.inject.FormParamValueParamProvider$FormParamValueProvider.apply(FormParamValueParamProvider.java:156)
at org.glassfish.jersey.server.internal.inject.FormParamValueParamProvider$FormParamValueProvider.apply(FormParamValueParamProvider.java:107)

0 个答案:

没有答案