Check out example codes for "typescript http get attach headers". It will help you in understanding the concepts better.

Code Example 1

const headerDict = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Access-Control-Allow-Headers': 'Content-Type',
}

const requestOptions = {                                                                                                                                                                                 
  headers: new HttpHeaders(headerDict), 
};

return this.http.get(this.heroesUrl, requestOptions)

Learn ReactJs, React Native from akashmittal.com