I am trying to send a block of ndjson to an API with the Angular httpClient. The endpoint I am reaching out to does not accept an array of objects and each JSON object must be newline delineated. Because of this, I cannot just use a typical JSON object but rather a string of JSON objects with a newline after each. Then I am trying to set the Content-Type header to applicaiton/json because the API still requires it but when the request goes out, httpClient is overriding my header and setting it back to text/plain.
How would I prevent this override from happening?
Code:
bulkImport(importData: string, indexName: string){
const headers = new HttpHeaders();
headers.set('Content-Type', 'application/json; charset=utf-8');
return this.http.put<any>(this._baseUrl + indexName + "/_bulk", importData, {headers: headers});
}