Giter Site home page Giter Site logo

Comments (10)

fyzs-n9001 avatar fyzs-n9001 commented on July 30, 2024 1

随便弄个get接口,然后返回一个base64的字符串不就行了吗,你这个库里默认做了json格式校验吧

from dio.

castrojr913 avatar castrojr913 commented on July 30, 2024 1

@wendux I have a similar issue when field name has a camel case format. For instance:

FormData.from({ "verifyCode": jsonEncode({ "phone": phoneNumber, "zipcode": zipCode, "device_id": deviceId, "os_id": osId, } })

It throws FormatException: Unexpected character. However, if I replace verifyCode by verifycode, It works. It's really weird.

from dio.

fyzs-n9001 avatar fyzs-n9001 commented on July 30, 2024

请求是成功的, 服务端返回的是一个Base64编码的字符串

from dio.

wendux avatar wendux commented on July 30, 2024

请贴出错误栈及触发的源码

from dio.

wendux avatar wendux commented on July 30, 2024

只有当返回头content-type指明为json时默认才会自动转换,如果你不想以让自动转换,可以指定接收的responseType, 文档里都有。

from dio.

akindone avatar akindone commented on July 30, 2024

when api is 500, response is <h1>Server Error (500)</h1> I use postman and find content-type is text/html . But I debug transformResponse find response's content-type is json ! (using default responseType) @wendux

from dio.

gideonpeters avatar gideonpeters commented on July 30, 2024

I had this issue and turns out I was already decoding json in my base options and tried decoding it again in my logic to handle the response data. Like this:

already decoding it by specifying the responseType as ResponseType.json

BaseOptions options = new BaseOptions(
    contentType: ContentType.json.toString(),
    responseType: ResponseType.json,
    followRedirects: false,
    validateStatus: (status) {
      return status < 500;
    },
  );

and I was still trying to decode it here
return jsonDecode(response.data);

instead of just
return response.data;

from dio.

riskiadi avatar riskiadi commented on July 30, 2024

better use http :p

from dio.

Godfather6666 avatar Godfather6666 commented on July 30, 2024

随便弄个弄个接口,然后返回一个base64的字符串不就行了,你这个库里默认了json格式的吧

我现在遇到这个问题了,可以请问你是怎么解决的吗

from dio.

nawzhin95 avatar nawzhin95 commented on July 30, 2024

any solution ?

from dio.

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.