Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: utils/tests/pub/curl_client_test.dart

Issue 11659009: Reapply "Fix URI encoding/decoding of + and space"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated tests Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/utils/uri_test.dart ('k') | utils/tests/pub/oauth2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library curl_client_test; 5 library curl_client_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 'other-field': 'other value' 51 'other-field': 'other value'
52 }).transform((response) { 52 }).transform((response) {
53 expect(response.statusCode, equals(200)); 53 expect(response.statusCode, equals(200));
54 expect(response.body, parse(equals({ 54 expect(response.body, parse(equals({
55 'method': 'POST', 55 'method': 'POST',
56 'path': '/', 56 'path': '/',
57 'headers': { 57 'headers': {
58 'content-type': [ 58 'content-type': [
59 'application/x-www-form-urlencoded; charset=UTF-8' 59 'application/x-www-form-urlencoded; charset=UTF-8'
60 ], 60 ],
61 'content-length': ['42'], 61 'content-length': ['40'],
62 'x-random-header': ['Value'], 62 'x-random-header': ['Value'],
63 'x-other-header': ['Other Value'] 63 'x-other-header': ['Other Value']
64 }, 64 },
65 'body': 'some-field=value&other-field=other%20value' 65 'body': 'some-field=value&other-field=other+value'
66 }))); 66 })));
67 }), completes); 67 }), completes);
68 }); 68 });
69 69
70 test('post without fields', () { 70 test('post without fields', () {
71 expect(new CurlClient().post(serverUrl, headers: { 71 expect(new CurlClient().post(serverUrl, headers: {
72 'X-Random-Header': 'Value', 72 'X-Random-Header': 'Value',
73 'X-Other-Header': 'Other Value', 73 'X-Other-Header': 'Other Value',
74 'Content-Type': 'text/plain' 74 'Content-Type': 'text/plain'
75 }).transform((response) { 75 }).transform((response) {
(...skipping 19 matching lines...) Expand all
95 'other-field': 'other value' 95 'other-field': 'other value'
96 }).transform((response) { 96 }).transform((response) {
97 expect(response.statusCode, equals(200)); 97 expect(response.statusCode, equals(200));
98 expect(response.body, parse(equals({ 98 expect(response.body, parse(equals({
99 'method': 'PUT', 99 'method': 'PUT',
100 'path': '/', 100 'path': '/',
101 'headers': { 101 'headers': {
102 'content-type': [ 102 'content-type': [
103 'application/x-www-form-urlencoded; charset=UTF-8' 103 'application/x-www-form-urlencoded; charset=UTF-8'
104 ], 104 ],
105 'content-length': ['42'], 105 'content-length': ['40'],
106 'x-random-header': ['Value'], 106 'x-random-header': ['Value'],
107 'x-other-header': ['Other Value'] 107 'x-other-header': ['Other Value']
108 }, 108 },
109 'body': 'some-field=value&other-field=other%20value' 109 'body': 'some-field=value&other-field=other+value'
110 }))); 110 })));
111 }), completes); 111 }), completes);
112 }); 112 });
113 113
114 test('put without fields', () { 114 test('put without fields', () {
115 expect(new CurlClient().put(serverUrl, headers: { 115 expect(new CurlClient().put(serverUrl, headers: {
116 'X-Random-Header': 'Value', 116 'X-Random-Header': 'Value',
117 'X-Other-Header': 'Other Value', 117 'X-Other-Header': 'Other Value',
118 'Content-Type': 'text/plain' 118 'Content-Type': 'text/plain'
119 }).transform((response) { 119 }).transform((response) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 test('without following redirects', () { 255 test('without following redirects', () {
256 var request = new http.Request('GET', serverUrl.resolve('/redirect')); 256 var request = new http.Request('GET', serverUrl.resolve('/redirect'));
257 request.followRedirects = false; 257 request.followRedirects = false;
258 expect(new CurlClient().send(request).chain(http.Response.fromStream) 258 expect(new CurlClient().send(request).chain(http.Response.fromStream)
259 .transform((response) { 259 .transform((response) {
260 expect(response.statusCode, equals(302)); 260 expect(response.statusCode, equals(302));
261 expect(response.isRedirect, true); 261 expect(response.isRedirect, true);
262 }), completes); 262 }), completes);
263 }); 263 });
264 } 264 }
OLDNEW
« no previous file with comments | « tests/utils/uri_test.dart ('k') | utils/tests/pub/oauth2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698