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

Side by Side Diff: pkg/http/test/utils.dart

Issue 65583004: Add utility methods for sending non-form data in pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review Created 7 years, 1 month 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 | « pkg/http/test/mock_client_test.dart ('k') | pkg/oauth2/lib/src/authorization_code_grant.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 test_utils; 5 library test_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 response.headers.contentType = 68 response.headers.contentType =
69 new ContentType( 69 new ContentType(
70 "application", "json", charset: outputEncoding.name); 70 "application", "json", charset: outputEncoding.name);
71 response.headers.set('single', 'value'); 71 response.headers.set('single', 'value');
72 72
73 var requestBody; 73 var requestBody;
74 if (requestBodyBytes.isEmpty) { 74 if (requestBodyBytes.isEmpty) {
75 requestBody = null; 75 requestBody = null;
76 } else if (request.headers.contentType.charset != null) { 76 } else if (request.headers.contentType != null &&
77 request.headers.contentType.charset != null) {
77 var encoding = requiredEncodingForCharset( 78 var encoding = requiredEncodingForCharset(
78 request.headers.contentType.charset); 79 request.headers.contentType.charset);
79 requestBody = encoding.decode(requestBodyBytes); 80 requestBody = encoding.decode(requestBodyBytes);
80 } else { 81 } else {
81 requestBody = requestBodyBytes; 82 requestBody = requestBodyBytes;
82 } 83 }
83 84
84 var content = { 85 var content = {
85 'method': request.method, 86 'method': request.method,
86 'path': request.uri.path, 87 'path': request.uri.path,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const isSocketException = const _SocketException(); 200 const isSocketException = const _SocketException();
200 201
201 /// A matcher for functions that throw SocketException. 202 /// A matcher for functions that throw SocketException.
202 const Matcher throwsSocketException = 203 const Matcher throwsSocketException =
203 const Throws(isSocketException); 204 const Throws(isSocketException);
204 205
205 class _SocketException extends TypeMatcher { 206 class _SocketException extends TypeMatcher {
206 const _SocketException() : super("SocketException"); 207 const _SocketException() : super("SocketException");
207 bool matches(item, Map matchState) => item is SocketException; 208 bool matches(item, Map matchState) => item is SocketException;
208 } 209 }
OLDNEW
« no previous file with comments | « pkg/http/test/mock_client_test.dart ('k') | pkg/oauth2/lib/src/authorization_code_grant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698