Created
May 16, 2018 04:26
-
-
Save tkssharma/aba4137633b31e812905b3931c3fb552 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core' | |
import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/do'; | |
@Injectable() | |
export class HeaderInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
const dummyrequest = req.clone({ | |
setHeaders: { | |
'AuthKey': '12345', 'DeviceID': '85645', | |
'content-type': 'application/json' | |
} | |
}) | |
console.log("Cloned Request"); | |
console.log(dummyrequest); | |
return next.handle(dummyrequest); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment