Created
January 6, 2019 11:31
-
-
Save tieppt/7ce8730120996c1d300f594d819a6516 to your computer and use it in GitHub Desktop.
This file contains 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 { | |
HttpHandler, | |
HttpProgressEvent, | |
HttpInterceptor, | |
HttpSentEvent, | |
HttpHeaderResponse, | |
HttpUserEvent, | |
HttpRequest, | |
HttpResponse | |
} from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
@Injectable() | |
export class NoCacheHttpInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): | |
Observable<HttpSentEvent | HttpHeaderResponse | HttpProgressEvent | HttpResponse<any> | HttpUserEvent<any>> { | |
const nextReq = req.clone({ | |
setHeaders: { | |
'Cache-Control': 'no-cache', | |
'Pragma': 'no-cache', | |
'Expires': 'Sat, 01 Jan 2000 00:00:00 GMT', | |
'If-Modified-Since': '0' | |
} | |
}); | |
return next.handle(nextReq); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment