Git Product home page Git Product logo

Comments (5)

hegaojian avatar hegaojian commented on August 16, 2024

可以使用不脱壳的请求方式,定义retrofit接口时 返回值定义为String

from jetpackmvvm.

429329513wanting avatar 429329513wanting commented on August 16, 2024

现在遇到这种情况,返回的body是个网页格式

vm:
var testResult = MutableLiveData<ResultState>()
接口定义:
suspend fun test(@QueryMap params: HashMap<String,String>):String
请求方式
requestNoCheck({ apiService.baiduInfo(header = header,params = params)},testResult,true)
结果错误信息显示:解析错误,请稍后再试1001Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

按理说不会去解析这个网页了,结果还是报解析错误。是因为字符串是网页格式的原因吗?还是说如果是非json格式字符串都会报这个错

from jetpackmvvm.

hegaojian avatar hegaojian commented on August 16, 2024

试试将返回值定义为 any 接收 看有没有问题

from jetpackmvvm.

429329513wanting avatar 429329513wanting commented on August 16, 2024

试试将返回值定义为 any 接收 看有没有问题

不行,同样的报错。感觉框架 处理 ResultState,还是涉及到解析了

from jetpackmvvm.

hegaojian avatar hegaojian commented on August 16, 2024

让后台改改数据格式吧,这个应该是属于后台的工作,数据给的不规范,正常的不管成功失败,都应该返回一个固定的格式

from jetpackmvvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.