Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6064cfa

Browse files
author
vakrilov
committed
NSHttp.get return type fixed
1 parent 0ab83bb commit 6064cfa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎nativescript-angular/http/ns-http.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {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';
33
import {Observable} from 'rxjs/Observable';
44
import 'rxjs/add/observable/fromPromise';
55
import {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()
1414
export 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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /