简体   繁体   中英

How to pass 3 arguments instead of 2 in Angular 5 HttpClientModule

I trying to send 3 parameters to the back-end Router

// Function to get user's profile image
getProfileImage(): Observable<Blob>{
  this.createAuthenticationHeaders(); // Create headers before sending to API
  return this._http.get(this.domain + '/authentication/getProfileImageok', this.options, { responseType: "blob" });
}

but it said that it only can send two

No, You can't send three params as per official documentation if you want to send some params you must be attached to options as the second parameter of the get request.

Demo object -

get(url: string, options: {
    headers?: HttpHeaders | {
        [header: string]: string | string[];
    };
    observe?: HttpObserve;
    params?: HttpParams | {
        [param: string]: string | string[];
    };
    reportProgress?: boolean;
    responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
    withCredentials?: boolean;
} = {}): Observable<any> 

For more information refer here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM