mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-11 10:00:48 -05:00
28 lines
620 B
TypeScript
28 lines
620 B
TypeScript
import {
|
|
HttpEvent,
|
|
HttpHandler,
|
|
HttpInterceptor,
|
|
HttpRequest,
|
|
} from '@angular/common/http'
|
|
import { Injectable } from '@angular/core'
|
|
import { Observable } from 'rxjs'
|
|
import { environment } from 'src/environments/environment'
|
|
|
|
@Injectable()
|
|
export class ApiVersionInterceptor implements HttpInterceptor {
|
|
constructor() {}
|
|
|
|
intercept(
|
|
request: HttpRequest<unknown>,
|
|
next: HttpHandler
|
|
): Observable<HttpEvent<unknown>> {
|
|
request = request.clone({
|
|
setHeaders: {
|
|
Accept: `application/json; version=${environment.apiVersion}`,
|
|
},
|
|
})
|
|
|
|
return next.handle(request)
|
|
}
|
|
}
|