Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.

Commit a94f3ce

Browse files
mvuksanovikraman
authored andcommitted
fix(Http): Auxiliary methods like get, put, post, etc. do not set type restriction on data being sent.
Fixes dart-archive#1051
1 parent 65037f8 commit a94f3ce

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/core_dom/http.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class Http {
421421
async.Future<HttpResponse> call({
422422
String url,
423423
String method,
424-
data,
424+
dynamic data,
425425
Map<String, dynamic> params,
426426
Map<String, dynamic> headers,
427427
bool withCredentials: false,
@@ -455,8 +455,6 @@ class Http {
455455
});
456456

457457
var serverRequest = (HttpResponseConfig config) {
458-
assert(config.data == null || config.data is String || config.data is dom.File);
459-
460458
// Strip content-type if data is undefined
461459
if (config.data == null) {
462460
new List.from(headers.keys)
@@ -536,7 +534,6 @@ class Http {
536534
* of parameters.
537535
*/
538536
async.Future<HttpResponse> get(String url, {
539-
String data,
540537
Map<String, dynamic> params,
541538
Map<String, String> headers,
542539
bool withCredentials: false,
@@ -545,7 +542,7 @@ class Http {
545542
interceptors,
546543
cache,
547544
timeout
548-
}) => call(method: 'GET', url: url, data: data, params: params, headers: headers,
545+
}) => call(method: 'GET', url: url, data: null, params: params, headers: headers,
549546
withCredentials: withCredentials, xsrfHeaderName: xsrfHeaderName,
550547
xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache: cache,
551548
timeout: timeout);
@@ -555,7 +552,7 @@ class Http {
555552
* of parameters.
556553
*/
557554
async.Future<HttpResponse> delete(String url, {
558-
String data,
555+
dynamic data,
559556
Map<String, dynamic> params,
560557
Map<String, String> headers,
561558
bool withCredentials: false,
@@ -574,7 +571,7 @@ class Http {
574571
* of parameters.
575572
*/
576573
async.Future<HttpResponse> head(String url, {
577-
String data,
574+
dynamic data,
578575
Map<String, dynamic> params,
579576
Map<String, String> headers,
580577
bool withCredentials: false,
@@ -592,7 +589,7 @@ class Http {
592589
* Shortcut method for PUT requests. See [call] for a complete description
593590
* of parameters.
594591
*/
595-
async.Future<HttpResponse> put(String url, String data, {
592+
async.Future<HttpResponse> put(String url, dynamic data, {
596593
Map<String, dynamic> params,
597594
Map<String, String> headers,
598595
bool withCredentials: false,
@@ -610,7 +607,7 @@ class Http {
610607
* Shortcut method for POST requests. See [call] for a complete description
611608
* of parameters.
612609
*/
613-
async.Future<HttpResponse> post(String url, String data, {
610+
async.Future<HttpResponse> post(String url, dynamic data, {
614611
Map<String, dynamic> params,
615612
Map<String, String> headers,
616613
bool withCredentials: false,
@@ -629,7 +626,7 @@ class Http {
629626
* of parameters.
630627
*/
631628
async.Future<HttpResponse> jsonp(String url, {
632-
String data,
629+
dynamic data,
633630
Map<String, dynamic> params,
634631
Map<String, String> headers,
635632
bool withCredentials: false,

0 commit comments

Comments
 (0)