收藏
回答

为什么小程序码获取返回结果中contentType不对?

今天中午小程序码获取接口:https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=,调用次数不多,但是好多次返回的结果header中的contentType为json,body中是二进制流,并没有错误码,这是body日志:

调用微信获取小程序二维码异常!微信返回信息=[123,34,101,114,114,99,111,100,101,34,58,52,48,48,48,49,44,34,101,114,114,109,115,103,34,58,34,105,110,118,97,108,105,100,32,99,114,101,100,101,110,116,105,97,108,44,32,97,99,99,101,115,115,95,116,111,107,101,110,32,105,115,32,105,110,118,97,108,105,100,32,111,114,32,110,111,116,32,108,97,116,101,115,116,32,114,105,100,58,32,54,48,100,57,53,98,101,51,45,52,49,50,54,56,55,51,53,45,50,100,101,48,54,48,54,52,34,125]

这是返回的header信息日志:

微信服务器返回头信息={"Connection":["keep-alive"],"Date":["Mon, 28 Jun 2021 05:19:31 GMT"],"Content-Type":["application/json; encoding\u003dutf-8"],"RetKey":["11"],"LogicRet":["40001"],"Content-Length":["118"]}

二进制流给到PDF的时候不能使用,以下是日志:

java.io.IOException: The byte array is not a recognized imageformat.

at com.itextpdf.text.Image.getInstance(Image.java:434) ~[itext-asian-5.2.9.jar:?]

为什么会发生这样的情况呢?以及针对这种情况有什么解决办法吗?

回答关注问题邀请回答
收藏

1 个回答

  • 茶叶蛋
    茶叶蛋
    2023-01-17

    大佬解决了吗,我也遇到相同问题了

    2023-01-17
    有用
    回复
登录 后发表内容