Giter VIP home page Giter VIP logo

Comments (6)

kuhnroyal avatar kuhnroyal commented on August 25, 2024

No idea what you are asking

from dio.

Nondirectional avatar Nondirectional commented on August 25, 2024

No idea what you are asking

For this request, I can get the response header and status code information when using JavaScript.
However, when using dio to send the request and parse the response, an exception is thrown, and I cannot get any information including the status code and response header except an error message in the onError method.

from dio.

Nondirectional avatar Nondirectional commented on August 25, 2024

The error is thrown when dio parses the response body. I want to know why the response cannot be parsed normally in dio/dart

from dio.

AlexV525 avatar AlexV525 commented on August 25, 2024

Please provide a runnable minimal reproducible example.

from dio.

Nondirectional avatar Nondirectional commented on August 25, 2024

Please provide a runnable minimal reproducible example.

sorry,my bad.

that is example:

      Dio dio = Dio(BaseOptions(
        baseUrl: "http://memos.w-wbr.space",
        connectTimeout: const Duration(seconds: 5),
        receiveTimeout: const Duration(seconds: 5),
      ));
      dio.interceptors.add(InterceptorsWrapper(onError: (error,handler) {
        print(error.message);
        print(error.stackTrace);
        print(error.response);
      }));
      Response? response = await dio.post("/api/v1/auth/status");
      print(response.data);

I realized that it might be a problem with the native http library. When I use the Dev tools running on a Windwos/Android device to view the request, I cannot see the response header.

from dio.

AlexV525 avatar AlexV525 commented on August 25, 2024

The exception is thrown from the underlying HTTP foundation, rather than the dio itself.

void main() async {
  final client = HttpClient();
  final request = await client.postUrl(
    Uri.parse('http://memos.w-wbr.space/api/v1/auth/status'),
  );
  final response = await request.close();
  print(response);
}

Consider submitting the issue to the Dart SDK.

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.