WkWebview with Advanced-http & native-http-connection-backend

Hello,

I am finally porting my application to use WkWebview, but since i am using some third party APIs i had problems with CORS, this led me to use the plugin https://github.com/silkimen/cordova-plugin-advanced-http, great this solves my problem of CORS not working on the device, but adds a problem browser now doesn’t work for development(bummer) i have found then the following plugin https://github.com/sneas/ionic-native-http-connection-backend which fixes my problem about not working on the Browser.

So currently my application is working on the Browser which is great. Is also working 100% on the device. But now i have a problem. Since i am using native http requests they will not show up in the “network” section of my browser but i also use the connection-backend plugin which wraps all the calls. Now i dont know how can i check the network requests in case is needed to debug some issue. Anyone has any idea?

Best regards
JMourao

1 Like

Well i managed a way to do it, i created a HttpInterceptor and console log when needed. If someone knows a better way let me know.

But it should be something like this

export class AppInterceptor implements HttpInterceptor {
  public intercept(
    request: HttpRequest<any>,
    next: HttpHandler
  ) : Observable<HttpEvent<any>> {
  console.log('Request -', request);

  return next.handle(request).pipe(tap(event) => { console.log(console.log('response -', event};

}

ps. this code wa not tested, if someone needs help let me know.

Best regards
JMourao

How are you using snaes/ionic-native-http-connection-backend in your service.ts file?

I mean how are you calling it and making the http connection?

can you give me a code sample?

1 Like

i need it too.@JMourao can you show how this work?