I have developed a package in flutter, and wanted to test it, which makes a network call. As we know that all network request while testing will return 404, and such HTTP reqeust needs to be mocked. However its also possible to use the orginal HTTP clients instead of mocking or getting 404. https://github.com/flutter/flutter/issues/19086#issuecomment-402639134
How do we do that ?
I have tried this :
main(){
TestWidgetsFlutterBinding.ensureInitialized();
HttpOverrides.runZoned(() {
test("Case1: Make HTTP request to an actual server", ()async{
let a = MyPackage.makesAHTTPRequest();
expect(a,"hello world");
});
}, createHttpClient: (SecurityContext c) => new HttpClient(context: c));
}
My URL is working all fine. But it keeps giving me 404.
How do one use real HTTP client, if needed that way?