Currently, I have to call everything like this, manually having to add the correct header to each request (and also have to manually stringify it seems..?). Is there a place I can define standard headers to be used for the whole application?
@Injectable()
export class MyService {
constructor(private http:Http) {
}
doSomething(data:MyObj) {
return this.http.post('/api/somebackend',
JSON.stringify(data),
{
headers: new Headers({
'Content-Type': 'application/json'
})
})
.map(e => e.json())
// ....
}
}