小编nit*_*ish的帖子

ionic native HTTP call with content-type text/plan?

I am trying to make a HTTP call and my Content-Type is text/plan but I am working with ionic-native/http which only take object and array,here is what I have tried

Error: advanced-http: "data" argument supports only following data types: Array, Object

TestIR(item){

  let headers = { 'Content-Type': 'text/plain'}; 
  let sender ='sendir,1:1,0,';
  let code = item.keys[10].code;
  let body = sender+code;
  let url= "http://10.75.0.120/v2/CI00e0148a";

  this.httpNative.setDataSerializer( "json" );
  this.httpNative.post(url,body,headers).then(val=> 
   {console.log(val)}).
  catch(e=>{console.log(e)})

}
Run Code Online (Sandbox Code Playgroud)

javascript http ionic-framework ionic3 angular

2
推荐指数
1
解决办法
5391
查看次数

标签 统计

angular ×1

http ×1

ionic-framework ×1

ionic3 ×1

javascript ×1