Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- headers: HttpHeaders;
- httpOptions;
- constructor(private http: HttpClient) {
- const token = localStorage.getItem("token");
- this.headers = new HttpHeaders({
- "Content-Type": "application/x-www-form-urlencoded"
- }).set("x-auth-token", token);
- this.httpOptions = {
- headers: this.headers,
- responseType: "json",
- observe: "response"
- };
- }
- test<T>(url: string) {
- return this.http.get<T>(url, this.httpOptions).pipe(
- map((res: HttpResponse<any>) => {
- console.log(res.headers);
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement