Tencent / APIJSON

🏆 实时 零代码、全功能、强安全 ORM 库 🚀 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构 🏆 Real-Time coding-free, powerful and secure ORM 🚀 providing APIs and Docs without coding by Backend, and the returned JSON of API can be customized by Frontend(Client) users
http://apijson.cn
Other
17.32k stars 2.16k forks source link

返回内容的不是json头 #55

Closed 35924784 closed 5 years ago

35924784 commented 6 years ago

环境信息

问题描述

返回内容的不是json头

错误信息

返回内容的不是json头

TommyLemon commented 6 years ago

麻烦把请求的 URL, JSON,返回结果,以及 错误截屏 发下

35924784 commented 6 years ago
default default
35924784 commented 5 years ago

最终在get上增加了Produces,响应头就正常了。

default
TommyLemon commented 5 years ago

原本应该是 PostMapping

    /**获取
     * @param request 只用String,避免encode后未decode
     * @param session
     * @return
     * @see {@link RequestMethod#GET}
     */
    @PostMapping(value = "get")
    public String get(@RequestBody String request, HttpSession session) {
        return new DemoParser(GET).setSession(session).parse(request);
    }

https://github.com/TommyLemon/APIJSON/blob/13b3e0ac7243b66dc9eb32ebe55204131f1ebe73/APIJSON-Java-Server/APIJSONDemo/src/main/java/apijson/demo/server/Controller.java

Response Header 也是 application/json image

35924784 commented 5 years ago

谢谢,已经找到原因了。需要请求头增加如下图参数就可以了:

default