Skip to content

Commit e34a29d

Browse files
tamascsabamhevery
authored andcommitted
docs(http): fix http documentation
Closes angular#3931
1 parent 9b009b3 commit e34a29d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

modules/angular2/src/http/backends/mock_backend.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export class MockConnection implements Connection {
5555
*
5656
* ```
5757
* var connection;
58-
* backend.connections.subscribe(c => connection = c);
59-
* http.request('data.json').subscribe(res => console.log(res.text()));
58+
* backend.connections.toRx().subscribe(c => connection = c);
59+
* http.request('data.json').toRx().subscribe(res => console.log(res.text()));
6060
* connection.mockRespond(new Response('fake response')); //logs 'fake response'
6161
* ```
6262
*
@@ -117,8 +117,8 @@ export class MockConnection implements Connection {
117117
* var http = injector.get(Http);
118118
* var backend = injector.get(MockBackend);
119119
* //Assign any newly-created connection to local variable
120-
* backend.connections.subscribe(c => connection = c);
121-
* http.request('data.json').subscribe((res) => {
120+
* backend.connections.toRx().subscribe(c => connection = c);
121+
* http.request('data.json').toRx().subscribe((res) => {
122122
* expect(res.text()).toBe('awesome');
123123
* async.done();
124124
* });
@@ -151,8 +151,8 @@ export class MockBackend implements ConnectionBackend {
151151
* }, [MockBackend, BaseRequestOptions]]);
152152
* var backend = injector.get(MockBackend);
153153
* var http = injector.get(Http);
154-
* backend.connections.subscribe(c => connection = c);
155-
* http.request('something.json').subscribe(res => {
154+
* backend.connections.toRx().subscribe(c => connection = c);
155+
* http.request('something.json').toRx().subscribe(res => {
156156
* text = res.text();
157157
* });
158158
* connection.mockRespond(new Response({body: 'Something'}));

modules/angular2/src/http/backends/xhr_backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class XHRConnection implements Connection {
9999
* })
100100
* class MyComponent {
101101
* constructor(http:Http) {
102-
* http('people.json').subscribe(res => this.people = res.json());
102+
* http('people.json').toRx().subscribe(res => this.people = res.json());
103103
* }
104104
* }
105105
* ```

modules/angular2/src/http/base_request_options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class RequestOptions {
8383
* constructor(baseRequestOptions:BaseRequestOptions, http:Http) {
8484
* var options = baseRequestOptions.merge({body: 'foobar', url: 'https://foo'});
8585
* var request = new Request(options);
86-
* http.request(request).subscribe(res => this.bars = res.json());
86+
* http.request(request).toRx().subscribe(res => this.bars = res.json());
8787
* }
8888
* }
8989
*

modules/angular2/src/http/static_response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {isJsObject} from './http_utils';
1515
* #Example
1616
*
1717
* ```
18-
* http.request('my-friends.txt').subscribe(response => this.friends = response.text());
18+
* http.request('my-friends.txt').toRx().subscribe(response => this.friends = response.text());
1919
* ```
2020
*
2121
* The Response's interface is inspired by the Response constructor defined in the [Fetch

0 commit comments

Comments
 (0)