Http 错误:";标题“;选项必须是字典样式
我正在尝试从后端获取Http 错误:";标题“;选项必须是字典样式,http,ionic-framework,ionic-native,cordova-plugin-advanced-http,ionic-native-http,Http,Ionic Framework,Ionic Native,Cordova Plugin Advanced Http,Ionic Native Http,我正在尝试从后端获取blob图像,并且在ionic 4应用程序中使用本机HTTP 实施情况如下: import { HTTP } from '@ionic-native/http/ngx'; constructor(private nativeHttp: HTTP) {} getAttachmentWithNativeHttp(url: string, parameters?: any): Observable<any> { url = url + this.common
blob
图像,并且在ionic 4应用程序中使用本机HTTP
实施情况如下:
import { HTTP } from '@ionic-native/http/ngx';
constructor(private nativeHttp: HTTP) {}
getAttachmentWithNativeHttp(url: string, parameters?: any): Observable<any> {
url = url + this.commonService.getQueryString(parameters);
var headers = this.getHeaders('GET', url);
this.nativeHttp.clearCookies();
this.nativeHttp.setServerTrustMode('nocheck');
const reqOptions: any = {
method: 'get',
responseType: 'blob' as 'blob',
headers: headers
}
return from(this.nativeHttp.sendRequest(url, reqOptions)).pipe(
finalize(() => { if (toIntercept) this.setProgressDialogVisibility(false) })
)
}
从'@ionic native/HTTP/ngx'导入{HTTP};
构造函数(私有nativeHttp:HTTP){}
getAttachmentWithNativeHttp(url:string,参数?:any):可观察
sendRequest()
允许我传递responseType
参数。我还尝试使用get()
,但每当我进行请求调用时,都会出现以下错误:
我缺少带有标题的内容
,或者我是否需要以另一种方式发送响应类型
,以获取blob图像?这不是正确的方法,但是params=JSON.parse(JSON.stringify(params))解除了我的阻止。可能是一个错误,但这不是正确的方法,但是params=JSON.parse(JSON.stringify(params))解除了我的阻碍。可能是个虫子