return this.http.post(this.url + '/' + endpoint, body, {headers: {
'customHeader1': 'changed',
'customHeader2': 'changed2'
}});
The above snippet is my http request. I can make the call without the headers object, however the endpoint I'm calling won't return data until I set those headers. Adding those headers caused the app to return the below error:
user.ts:50 ERROR TypeError: req.headers.forEach is not a function
How can I resolve this and set my headers in the http request?
These are my imports
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Http, Response, RequestOptionsArgs, RequestMethod, Headers, Request
} from '@angular/http';
This is my constructor
constructor(public http: HttpClient) {}