Giter Site home page Giter Site logo

Comments (7)

AlexV525 avatar AlexV525 commented on July 30, 2024

The test passes.

image
test('Query parameters equality', () async {
  final dio = Dio()
    ..httpClientAdapter = EchoAdapter()
    ..options.baseUrl = EchoAdapter.mockBase;
  const queryParameters = <String, String>{'a': '1', 'b': '2'};
  final response = await dio.get(
    '/test',
    queryParameters: queryParameters,
  );
  expect(
    response.realUri.queryParameters.toString(),
    equals(response.requestOptions.queryParameters.toString()),
  );
});

from dio.

edeuss avatar edeuss commented on July 30, 2024

@AlexV525 I updated the title since it was incorrect, apologies.

Here is what's happening for us:

Uri we input: /tracks?range=months&orderBy=TIME
Response output: /tracks?orderBy=TIME&range=months

from dio.

AlexV525 avatar AlexV525 commented on July 30, 2024
image
test('Query parameters equality', () async {
  final dio = Dio()..httpClientAdapter = EchoAdapter();
  final uri = Uri.base.resolve(
    '${EchoAdapter.mockBase}/test?range=months&orderBy=TIME',
  );
  final response = await dio.getUri(uri);
  expect(
    response.realUri.queryParameters.toString(),
    equals(response.requestOptions.uri.queryParameters.toString()),
  );
});

from dio.

edeuss avatar edeuss commented on July 30, 2024

@AlexV525 You are testing the uri's in the response object. Those are both the same, It's the uri in dio.getUri(uri); and the response object uri's that have the different query parameter order.

from dio.

AlexV525 avatar AlexV525 commented on July 30, 2024
image
test('Query parameters equality', () async {
  final dio = Dio()..httpClientAdapter = EchoAdapter();
  final uri = Uri.base.resolve(
    '${EchoAdapter.mockBase}/test?range=months&orderBy=TIME',
  );
  final response = await dio.getUri(uri);
  expect(
    response.realUri.queryParameters.toString(),
    equals(uri.queryParameters.toString()),
  );
});

from dio.

kuhnroyal avatar kuhnroyal commented on July 30, 2024

Since we copy the query parameter map in a couple places this might be possible but you need to provide a reproducible example.

from dio.

AlexV525 avatar AlexV525 commented on July 30, 2024

Please attach a reproducible example so we may take further investigations.

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.