Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend api responds garbled in browser[后端api在浏览器中响应乱码] #297

Closed
Jixiangup opened this issue Mar 18, 2022 · 0 comments

Comments

@Jixiangup
Copy link
Collaborator

建议先去浏览下文档和部署常见问题
快速开始
部署常见问题

bug场景描述

项目使用浏览器访问后端接口时响应数据会出现乱码问题,但是使用postman不会(因为content-type没有指定编码而是使用默认)

bug日志信息或数据信息

bug相关代码

image

class com.dtstack.taier.develop.config.MvcConfig

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
        List<MediaType> mediaTypes = new ArrayList<>();
        mediaTypes.add(MediaType.TEXT_PLAIN);
        mediaTypes.add(MediaType.APPLICATION_JSON);
        mediaTypes.add(MediaType.MULTIPART_FORM_DATA);
        mappingJackson2HttpMessageConverter.setSupportedMediaTypes(mediaTypes);
        converters.add(0, mappingJackson2HttpMessageConverter);
        super.configureMessageConverters(converters);
    }

提示的异常或者没有达到的效果

  • before solving [解决之前]

image

  • after solving [解决之后]

image

add bug tag for him and i will fix it^.^

vainhope added a commit that referenced this issue Mar 24, 2022
fix: Backend api responds garbled in browser (#297)
yyl4ever pushed a commit that referenced this issue Oct 10, 2022
fix: Backend api responds garbled in browser (#297)
poxiao8 pushed a commit that referenced this issue Oct 10, 2022
fix: Backend api responds garbled in browser (#297)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants