mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Clean up RC1 bug workaround
This commit is contained in:
@@ -9,11 +9,13 @@ export class FetchData {
|
|||||||
public forecasts: WeatherForecast[];
|
public forecasts: WeatherForecast[];
|
||||||
|
|
||||||
constructor(http: Http) {
|
constructor(http: Http) {
|
||||||
|
// Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
|
||||||
|
let isServerSide = typeof window === 'undefined';
|
||||||
|
let options: any = isServerSide ? { headers: { Connection: 'keep-alive' } } : null;
|
||||||
|
|
||||||
// TODO: Switch to relative URL once angular-universal supports them
|
// TODO: Switch to relative URL once angular-universal supports them
|
||||||
// https://github.com/angular/universal/issues/348
|
// https://github.com/angular/universal/issues/348
|
||||||
http.get('http://localhost:5000/api/SampleData/WeatherForecasts', {
|
http.get('http://localhost:5000/api/SampleData/WeatherForecasts', options).subscribe(result => {
|
||||||
headers: <any>{ Connection: 'keep-alive' } // Workaround for RC1 bug. TODO: Remove this after updating to RC2
|
|
||||||
}).subscribe(result => {
|
|
||||||
this.forecasts = result.json();
|
this.forecasts = result.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user