Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route matches ignore baseUrl #135

Open
corecode opened this issue Oct 13, 2022 · 0 comments
Open

route matches ignore baseUrl #135

corecode opened this issue Oct 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@corecode
Copy link

Description

UrlRequestMatcher and MatchesRequest on RequestOptions ignore Dio's baseUrl and compare against path instead of uri.

Steps to reproduce

    test('should match baseUrl', () async {
      // arrange
      final tDio = Dio();
      final tDioAdapter = DioAdapter(dio: tDio);
      tDioAdapter.onGet(
          'http://example.com/foo/bar', (server) => server.reply(200, 'yey'));

      // act
      tDio.options.baseUrl = 'http://example.com/foo/';
      // final result = await tDio.get('http://example.com/foo/bar'); // this works
      final result = await tDio.get('bar'); // this fails

      // assert
      expect(result.data, 'yey');
    });

Expected behavior

baseUrl is considered in route matching.

@corecode corecode added the bug Something isn't working label Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant