@yuuvis/client-core 2.3.7 → 2.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@ngx-translate/core';
2
2
  import { TranslateService, TranslateLoader, MissingTranslationHandler, TranslateModule } from '@ngx-translate/core';
3
3
  export { TranslateDirective, TranslateLoader, TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
4
- import { HttpErrorResponse, HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpEventType, provideHttpClient, withInterceptors } from '@angular/common/http';
4
+ import { HttpErrorResponse, HttpClient, HttpHeaders, HttpRequest, HttpParams, HttpResponse, HttpEventType, provideHttpClient, withInterceptors } from '@angular/common/http';
5
5
  import * as i0 from '@angular/core';
6
6
  import { inject, Injectable, InjectionToken, Inject, signal, Directive, Pipe, importProvidersFrom, provideAppInitializer } from '@angular/core';
7
7
  import { tap, finalize, shareReplay, catchError, map, switchMap, first, filter, scan, delay } from 'rxjs/operators';
@@ -1040,11 +1040,17 @@ class BackendService {
1040
1040
  * @param uri The target REST URI
1041
1041
  * @param formData FormData to be 'posted'
1042
1042
  * @param base The Base URI (backend service) to be used
1043
- * @param requestOptions Additional request options
1043
+ * @param requestOptions Additional request options (see HttpRequest for details)
1044
1044
  * @returns The return value of the target POST endpoint
1045
1045
  */
1046
1046
  postMultiPart(uri, formData, base, requestOptions) {
1047
- return this.#http.post(`${this.getApiBase(base)}${uri}`, formData, this.getHttpOptions(requestOptions));
1047
+ // Creating a multipart/form-data request like this ensures that the Content-Type is set correctly including
1048
+ // the multipart boundary which is required by the server to parse the request.
1049
+ // If we would set the Content-Type header to multipart/form-data manually the boundary would be missing
1050
+ // and the request would fail.
1051
+ // As our post method already sets the Content-Type to application/json we can't use it for multipart requests.
1052
+ const req = new HttpRequest('POST', `${this.getApiBase(base)}${uri}`, formData, requestOptions);
1053
+ return this.#http.request(req);
1048
1054
  }
1049
1055
  /**
1050
1056
  * Wrapped HTTP PATCH method