import { HttpEvent , HttpHandler , HttpInterceptor , HttpRequest } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; @ Injectable ( ) export class StandardHeaderInterceptor implements HttpInterceptor { intercept ( req , next ) { if ( ! req . headers . has ( 'Content-Type' ) ) { req = req . clone ( { headers : req . headers . set ( 'Content-Type' , 'application/json' ) } ) ; } req = req . clone ( { headers : req . headers . set ( 'Accept' , 'application/json' ) } ) ; return next . handle ( req ) ; } }