When you are using interceptor in angular you can make use of this code snippet ``` ``` // UploadFileService.ts uploadFile(file: File) { const formData: FormData = new FormData(); formData.append('file', file); return this.http.post<any>(`${this.api}/${this.apiName}`, formData); } // http.interceptor.ts export class APIInterceptor implements HttpInterceptor { intercept(request: HttpRequest<any>, next: HttpHandler) { let authReq; if (request.method === 'POST' && request.body instanceof FormData) { authReq = request.clone({ setHeaders: { Authorization: `Bearer ${this.auth.getToken()}`, }, }); } else { authReq = request.clone({ setHeaders: { 'Content-Type': 'application/json; charset=utf-8', Accept: 'application/json', Authorization: `Bearer ${this.auth.getToken()}`, }, }); } return next.handle(authReq).pipe(catchError((err) => this.handleAuthError(err))); } } ```