11import { Injectable } from '@angular/core' ;
2- import { HTTP_PROVIDERS , Http , XHRBackend , XHRConnection , ConnectionBackend , RequestOptions , RequestOptionsArgs , ResponseOptions , ResponseType , Response , Request , BrowserXhr , XSRFStrategy } from '@angular/http' ;
2+ import { HTTP_PROVIDERS , Http , XHRBackend , ConnectionBackend , RequestOptions , RequestOptionsArgs , ResponseOptions , ResponseType , Response , XSRFStrategy } from '@angular/http' ;
33import { Observable } from 'rxjs/Observable' ;
44import 'rxjs/add/observable/fromPromise' ;
55import { NSFileSystem } from '../file-system/ns-file-system' ;
@@ -8,7 +8,7 @@ export class NSXSRFStrategy {
88 public configureRequest ( req : any ) {
99 // noop
1010 }
11- }
11+ }
1212
1313@Injectable ( )
1414export class NSHttp extends Http {
@@ -20,12 +20,12 @@ export class NSHttp extends Http {
2020 * Performs a request with `get` http method.
2121 * Uses a local file if `~/` resource is requested.
2222 */
23- get ( url : string , options ?: RequestOptionsArgs ) : Observable < Response | any > {
23+ get ( url : string , options ?: RequestOptionsArgs ) : Observable < Response > {
2424 if ( url . indexOf ( '~' ) === 0 || url . indexOf ( '/' ) === 0 ) {
2525 // normalize url
2626 url = url . replace ( '~' , '' ) . replace ( '/' , '' ) ;
2727 // request from local app resources
28- return Observable . fromPromise ( new Promise ( ( resolve , reject ) => {
28+ return Observable . fromPromise < Response > ( new Promise ( ( resolve , reject ) => {
2929 let app = this . nsFileSystem . currentApp ( ) ;
3030 let localFile = app . getFile ( url ) ;
3131 if ( localFile ) {
@@ -58,7 +58,8 @@ export const NS_HTTP_PROVIDERS: any[] = [
5858 HTTP_PROVIDERS ,
5959 { provide : XSRFStrategy , useValue : new NSXSRFStrategy ( ) } ,
6060 NSFileSystem ,
61- { provide : Http , useFactory : ( backend , options , nsFileSystem ) => {
61+ {
62+ provide : Http , useFactory : ( backend , options , nsFileSystem ) => {
6263 return new NSHttp ( backend , options , nsFileSystem ) ;
6364 } , deps : [ XHRBackend , RequestOptions , NSFileSystem ]
6465 }
0 commit comments