Home > Software design >  Ionic how to upload a file as binary using httpclient getting 599 status
Ionic how to upload a file as binary using httpclient getting 599 status

Time:03-05

Hi i am sending blob file to with httpclient and getting 599 status code please help

this.http.post("url",blobfile,{headers:'content-type':'image/jpeg'}).subscribe(r=>{
console.log(r)
})

getting 599 error this works fine on webview but doesn't work on native android device as i am using ionic-native-http-connection-backend and included this in app.module.ts

providers:[{ provide: HttpBackend, useClass: NativeHttpFallback, deps: [Platform, NativeHttpBackend, HttpXhrBackend] }]

i am using ionic 6 can anyone help me with this?

CodePudding user response:

use this in app.module.ts resolves the issue

{
provide: HttpBackend, useFactory:
 (platform: Platform, nativeHttpBackend: NativeHttpBackend, httpXhrBackend: HttpXhrBackend) = {
          if (platform.is('android')) {
            return httpXhrBackend;
          } else {
            return new NativeHttpFallback(platform, nativeHttpBackend, httpXhrBackend);
          }
  }, deps: [Platform, NativeHttpBackend, HttpXhrBackend]
}

this resolves 599 issue

  • Related