Skip to content

Instantly share code, notes, and snippets.

@bbogdanov
Last active November 1, 2017 08:42
Show Gist options
  • Select an option

  • Save bbogdanov/aa9f0d5c60893199ed5e60cddeaf22ce to your computer and use it in GitHub Desktop.

Select an option

Save bbogdanov/aa9f0d5c60893199ed5e60cddeaf22ce to your computer and use it in GitHub Desktop.

Revisions

  1. bbogdanov revised this gist Nov 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion server-location.interceptor.ts
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ export class ServerLocationInterceptor implements HttpInterceptor {
    next: HttpHandler): Observable<HttpEvent<any>> {

    const clonedRequest: HttpRequest<any> = req.clone({
    url: 'https://someurl.example/' + req.url
    url: 'https://someurl.example/'
    });

    return next.handle(clonedRequest);
  2. bbogdanov created this gist Nov 1, 2017.
    18 changes: 18 additions & 0 deletions server-location.interceptor.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    import { Injectable } from '@angular/core';
    import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
    import { Observable } from 'rxjs/Observable';

    @Injectable()
    export class ServerLocationInterceptor implements HttpInterceptor {

    public intercept(req: HttpRequest<any>,
    next: HttpHandler): Observable<HttpEvent<any>> {

    const clonedRequest: HttpRequest<any> = req.clone({
    url: 'https://someurl.example/' + req.url
    });

    return next.handle(clonedRequest);
    }

    }