dart-lang / http

A composable API for making HTTP requests in Dart.
https://pub.dev/packages/http
BSD 3-Clause "New" or "Revised" License
1.01k stars 342 forks source link

cuppertino_http: allow normal dart test (without Flutter) #806

Open xvrh opened 1 year ago

xvrh commented 1 year ago

I would like to use cupertino_http on my mac directly with dart test (out of a Flutter context).

Currently running `dart test integration_test/api_test.dart' fails with this error:

 Invalid argument(s): Failed to load dynamic library 'cupertino_http.framework/cupertino_http': dlopen(cupertino_http.framework/cupertino_http, 0x0001): tried: '/Users/xavier/flutter/bin/cache/dart-sdk/bin/./cupertino_http.framework/cupertino_http' (no such file), '/Users/xavier/flutter/bin/cache/dart-sdk/bin/../../../cupertino_http.framework/cupertino_http' (no such file), '/Users/xavier/flutter/bin/cache/dart-sdk/bin/Frameworks/cupertino_http.framework/cupertino_http' (no such file), '/Users/xavier/flutter/bin/cache/dart-sdk/bin/./cupertino_http.framework/cupertino_http' (no such file), '/Users/xavier/flutter/bin/cache/dart-sdk/bin/../../../cupertino_http.framework/cupertino_http' (no such file), '/Users/xavier/flutter/bin/cache/dart-sdk/bin/Frameworks/cupertino_http.framework/cupertino_http' (no such file), 'cupertino_http.framework/cupertino_http' (no such file), '/System/Library/Frameworks/cupertino_http.framework/cupertino_http' (no such file)
  dart:ffi                                             new DynamicLibrary.open
  package:cupertino_http/src/utils.dart 32:27          _loadHelperDynamicLibrary
  package:cupertino_http/src/utils.dart 40:15          _loadHelperLibrary
  package:cupertino_http/src/utils.dart 28:43          helperLibs
  package:cupertino_http/src/utils.dart                helperLibs
  package:cupertino_http/cupertino_http.dart 850:59    URLSession._delegate
  package:cupertino_http/cupertino_http.dart           URLSession._delegate
  package:cupertino_http/cupertino_http.dart 945:43    new URLSession.sessionWithConfiguration
  package:cupertino_http/cupertino_client.dart 201:32  new CupertinoClient.fromSessionConfiguration
  package:cupertino_http/cupertino_client.dart 195:28  new CupertinoClient.defaultSessionConfiguration
  integration_test/utils_api.dart 34:28                ApiContext._createMacClient
  integration_test/utils_api.dart 27:41                new ApiContext
  integration_test/api_test.dart 20:18       main.<fn>

My use case is to be able to run http tests with a server requiring a VPN.

Thanks

brianquinlan commented 1 year ago

Hi @xvrh , I'd like that too :-(

Unfortunately, there is no convenient way to inject a native build step in dart-without-flutter and cupertino_http includes some Objective-C code.

soeren-schmaljohann-2denker commented 4 months ago

Any updates on this?

brianquinlan commented 4 months ago

Any updates on this?

No. Until Dart supports Native assets there isn't a good solution for this problem.

What is your use case? We have http.testing for testing.