http-mock-adapter
http-mock-adapter copied to clipboard
route matches ignore `baseUrl`
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.