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

Ionic 3 Http get request - null response iOS only

$
0
0

@bhandaribhumin wrote:

url google api https://maps.googleapis.com/maps/api/directions/json?origin=35.905414,-78.865128&destination=35.8187764,-78.6733007&mode=walking&key=xxxxxxxxxxxx

  return Observable.create(observer => {
    let access: any;
    console.log('url google api ',url);
    //  let options = new RequestOptions({ headers: headers });
      this.http.get(url).timeout(25000)
        .map(res => {
          console.log('GET RESPONSE  =>', res);
          console.log('GET RESPONSE headers => ', res.headers);
    ]
          // If request fails, throw an Error that will be caught
          if (res.status < 200 || res.status >= 300) {
            throw new Error('This request has failed ' + res.status);
          }
          // If everything went fine, return the response
          else {
            console.log('GET IN SUCCESS RESPONSE ==> ');
            return res.json();
          }
        }).subscribe(data => {
          access = data;
          console.log('<== GET IN Success subscribe ==> ');
          console.log("Custome Data observer Error :+", access);
          observer.next(access);
          observer.complete();
        }, (err) => {
          console.log('<== GET IN Error subscribe ==> ');
          console.log("Custome Data observer Error :+", err);
          observer.next(false);
          observer.complete();

        });

    }).catch((error) => {
      console.log('In Observable Error => ', error);
    });

log is:

<== GET IN Error subscribe ==>
Custome Data observer Error :+ Response with status: 0 for URL: null

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49308

Trending Articles



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