@@ -17,6 +17,7 @@ import {MockBackend} from 'angular2/src/http/backends/mock_backend';
1717import { Response } from 'angular2/src/http/static_response' ;
1818import { RequestMethods } from 'angular2/src/http/enums' ;
1919import { BaseRequestOptions } from 'angular2/src/http/base_request_options' ;
20+ import { Request } from 'angular2/src/http/static_request' ;
2021
2122class SpyObserver extends SpyObject {
2223 onNext : Function ;
@@ -79,6 +80,12 @@ export function main() {
7980 connection . mockRespond ( baseResponse )
8081 } ) ) ;
8182
83+ it ( 'should accept a fully-qualified request as its only parameter' , ( ) => {
84+ var req = new Request ( 'https://google.com' ) ;
85+ backend . connections . subscribe ( c => { expect ( c . request . url ) . toBe ( 'https://google.com' ) ; } ) ;
86+ httpFactory ( req ) . subscribe ( ( ) => { } ) ;
87+ } ) ;
88+
8289
8390 it ( 'should perform a get request for given url if passed a ConnectionConfig instance' ,
8491 inject ( [ AsyncTestCompleter ] , async => {
@@ -108,9 +115,20 @@ export function main() {
108115
109116
110117 describe ( 'Http' , ( ) => {
111- it ( 'should return an Observable' , ( ) => {
112- expect ( typeof http . request ( url ) . subscribe ) . toBe ( 'function' ) ;
113- backend . resolveAllConnections ( ) ;
118+ describe ( '.request()' , ( ) => {
119+ it ( 'should return an Observable' , ( ) => {
120+ expect ( typeof http . request ( url ) . subscribe ) . toBe ( 'function' ) ;
121+ backend . resolveAllConnections ( ) ;
122+ } ) ;
123+
124+
125+ it ( 'should accept a fully-qualified request as its only parameter' , ( ) => {
126+ var req = new Request ( 'https://google.com' ) ;
127+ backend . connections . subscribe ( c => {
128+ expect ( c . request . url ) . toBe ( 'https://google.com' ) ;
129+ } ) ;
130+ http . request ( req ) . subscribe ( ( ) => { } ) ;
131+ } ) ;
114132 } ) ;
115133
116134
0 commit comments