0

This issue has stopped me in my tracks.

Error: XMLHttpRequest error.
    C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 910:28                get current
packages/http/src/browser_client.dart 69:22                                                                                    <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1685:54                                              runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 159:18                                        handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 766:44                                        handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 795:13                                        _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 592:7                                         [_complete]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11                                         _cancelAndValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1288:7                                             <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39  dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37301:58                              <fn>

. I have tried deleting the cache tool stamp file. Adding "--disable-web-security". This is my method that is throwing the error when called.

Future CustomerCall(String CustomerID, String APIKey) async {
  final queryParameters = {
    'APIKey': APIKey,
    'customer_id': CustomerID
  };

  final uri = Uri.https('8.8.8.8', '/Customers', queryParameters);
  final response = await http.get(uri, headers: {
    "Accept": "application/json",
    "Access-Control-Allow-Origin": "*"
  });

  print(response.statusCode);
  print(response.body);
}

. When I replace the local host IP with something like "https://jsonplaceholder.typicode.com/todos/1". It works just fine. I am not sure if its because of the port number being in the URL or if it possibly could be because the page does not have a SSL cert but is under a HTTPS rather than a HTTP. This is an API call to this URL for another application we have made for users to transfer data from a windows application the a web application.

1

1 Answer 1

1

you must be handle this issue from server side

actually in api side must be configure CORS mechanism

Sign up to request clarification or add additional context in comments.

2 Comments

Is this in the API application itself or is it in the server configuration
Api application, it is Django?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.