Code Monkey home page Code Monkey logo

Comments (11)

wendux avatar wendux commented on May 10, 2024 1

@nickzhuo 不能用localhost, localhost代表的是手机的地址,你要访问电脑的话要用ip

:octocat: From gitme Android

from dio.

wendux avatar wendux commented on May 10, 2024

8080端口的服务存在吗?

from dio.

zll33 avatar zll33 commented on May 10, 2024

hi,我想请问下,我起本地服务,host:http://localhost:9031。一发请求就提示“DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 36632”
请问知道原因吗 ?

from dio.

xgbxmgg avatar xgbxmgg commented on May 10, 2024

你好, jairwen ,我遇到和你一样的问题,我通过读取源码发现,Dio的请求返回的类型默认时json类型(这样就会有一个TransFormer转换过程,转换过程需要mimeType的,源码是这样的

if (options.responseType == ResponseType.JSON &&
        response.headers.contentType.mimeType == ContentType.JSON.mimeType) {
      return JSON.decode(responseBody);
    }
```),而当请求为get的时候,你可能没有设置options为new Options(responseType: ResponseType.PLAIN)。

from dio.

wendux avatar wendux commented on May 10, 2024

@xgbxmgg 这块逻辑github源码已更新,但还没有发布到pub上

from dio.

wendux avatar wendux commented on May 10, 2024

已修复,请升级dio到最新版本

from dio.

junboguan avatar junboguan commented on May 10, 2024

@zll33 你的问题解决了吗?我也遇到了同样的问题,如果解决了,可否告知一下是什么原因和解决方法,谢谢

from dio.

nickzhuo avatar nickzhuo commented on May 10, 2024

@zll33 你的问题解决了吗?在我的环境目前还在。我的版本1.0.6。

from dio.

nickzhuo avatar nickzhuo commented on May 10, 2024

@wendux 没有修复这个在localhost的问题啊!

from dio.

nickzhuo avatar nickzhuo commented on May 10, 2024

@wendux 明白了,学到了!

from dio.

fuwenjiang1997 avatar fuwenjiang1997 commented on May 10, 2024

发现并没有修复这个问题呢,4.0.3版本

  var dio = Dio();
  init({ String? baseUrl }) {
    dio.options.baseUrl = 'http://127.0.0.1:8099';
    dio.options.connectTimeout = 5000; //5s
    dio.options.receiveTimeout = 3000;
    CookieJar cookieJar = CookieJar();
    dio.interceptors.add(CookieManager(cookieJar));
  }

dio.get('/test');会报错:SocketException: OS Error: Connection refused, errno = 111, address = 127.0.0.1, port = 52816

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.