Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49374

For any URL I try to access from the Emulator using HttpClient (Ionic v3), and I get the message: "Http failure response for (unknown url): 0 Unknown Error

$
0
0

@marciusbezerra wrote:

For any URL I try to access from the Emulator using HttpClient (Ionic v3), and I get the message:

            {"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown
            Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url):
           0 Unknown Error","error":{"isTrusted":true}}

Note: Other apps usually connect to the same emulator
Note: Postman normally connects, Node Js (request) normally connects

Code:

import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable()
export class AuthService {

    constructor(
        private http: HttpClient) {
    }

    loginTest() {

        this.http.get('https://www.google.com/')
            .subscribe(
                ret => {
                    console.log('ret: ', JSON.stringify(ret));
                    alert('ret: ' + JSON.stringify(ret));
                },
                error => {
                    console.log('error: ', JSON.stringify(error));
                    alert('error: ' + JSON.stringify(error));
                }
            );
    }
}
Ionic:

   Ionic CLI          : 5.0.2 (C:\Users\Marcius Bezerra\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 6 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.4

System:

   Android SDK Tools : 26.1.1 (D:\AndroidSdk)
   NodeJS            : v10.14.2 (D:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>