blob: e69a9d009c802a8abe53d731081c7f6c40d9ca86 [file] [log] [blame]
import {HttpEvent} from '@angular/common/http'
import {HttpRequest} from '@angular/common/http'
import {HttpHandler} from '@angular/common/http'
import {HttpInterceptor} from '@angular/common/http'
import {Injectable} from '@angular/core'
import {Observable} from 'rxjs'
import {RestUrlService} from './rest-url.service'
@Injectable()
export class RestUrlInterceptor implements HttpInterceptor {
constructor(
private _rest: RestUrlService
) {
// No-op.
}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const nextReq = req.clone({
url: this._rest.url(req.url)
})
return next.handle(nextReq)
}
}