xiaoymin / knife4j

Knife4j is a set of Swagger2 and OpenAPI3 All-in-one enhancement solution
https://doc.xiaominfo.com
Apache License 2.0
4.14k stars 622 forks source link

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #859

Open yibird opened 1 week ago

yibird commented 1 week ago

用的com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter 4.5.0版本。 看了issue 我在WebConfig类添加了

private final Jackson2ObjectMapperBuilder jacksonBuilder;
@Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { converters.add(new ByteArrayHttpMessageConverter()); converters.add(new MappingJackson2HttpMessageConverter(jacksonBuilder.build())); }

但是访问 knife4j页面还是出现 SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON 。一开始我以为是转换器的顺序问题,但是调整了顺序还是出无效的JSON

xiaoymin commented 1 week ago

估计是这个问题

https://doc.xiaominfo.com/docs/faq/v4/knife4j-base64-response

yibird commented 1 week ago

我加了没用 大佬能麻烦看一下吗? 另外 /v3/api-docs 返回的数据 Apifox 也是能导入的