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

Commit d9e494a

Browse files
mvuksanochirayuk
authored andcommitted
fix(Http): Auxiliary methods like get, put, post, etc. do not set type restriction on data being sent.
Fixes #1051
1 parent 05369c7 commit d9e494a

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
@@ -435,7 +435,7 @@ class Http {
435435
async.Future<HttpResponse> call({
436436
String url,
437437
String method,
438-
data,
438+
dynamic data,
439439
Map<String, dynamic> params,
440440
Map<String, dynamic> headers,
441441
bool withCredentials: false,
@@ -469,8 +469,6 @@ class Http {
469469
});
470470

471471
serverRequest(HttpResponseConfig config) {
472-
assert(config.data == null || config.data is String || config.data is dom.File);
473-
474472
// Strip content-type if data is undefined
475473
if (config.data == null) {
476474
new List.from(headers.keys)
@@ -553,7 +551,6 @@ class Http {
553551
* of parameters.
554552
*/
555553
async.Future<HttpResponse> get(String url, {
556-
String data,
557554
Map<String, dynamic> params,
558555
Map<String, String> headers,
559556
bool withCredentials: false,
@@ -562,7 +559,7 @@ class Http {
562559
interceptors,
563560
cache,
564561
timeout
565-
}) => call(method: 'GET', url: url, data: data, params: params, headers: headers,
562+
}) => call(method: 'GET', url: url, data: null, params: params, headers: headers,
566563
withCredentials: withCredentials, xsrfHeaderName: xsrfHeaderName,
567564
xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache: cache,
568565
timeout: timeout);
@@ -572,7 +569,7 @@ class Http {
572569
* of parameters.
573570
*/
574571
async.Future<HttpResponse> delete(String url, {
575-
String data,
572+
dynamic data,
576573
Map<String, dynamic> params,
577574
Map<String, String> headers,
578575
bool withCredentials: false,
@@ -591,7 +588,7 @@ class Http {
591588
* of parameters.
592589
*/
593590
async.Future<HttpResponse> head(String url, {
594-
String data,
591+
dynamic data,
595592
Map<String, dynamic> params,
596593
Map<String, String> headers,
597594
bool withCredentials: false,
@@ -609,7 +606,7 @@ class Http {
609606
* Shortcut method for PUT requests. See [call] for a complete description
610607
* of parameters.
611608
*/
612-
async.Future<HttpResponse> put(String url, String data, {
609+
async.Future<HttpResponse> put(String url, dynamic data, {
613610
Map<String, dynamic> params,
614611
Map<String, String> headers,
615612
bool withCredentials: false,
@@ -627,7 +624,7 @@ class Http {
627624
* Shortcut method for POST requests. See [call] for a complete description
628625
* of parameters.
629626
*/
630-
async.Future<HttpResponse> post(String url, String data, {
627+
async.Future<HttpResponse> post(String url, dynamic data, {
631628
Map<String, dynamic> params,
632629
Map<String, String> headers,
633630
bool withCredentials: false,
@@ -646,7 +643,7 @@ class Http {
646643
* of parameters.
647644
*/
648645
async.Future<HttpResponse> jsonp(String url, {
649-
String data,
646+
dynamic data,
650647
Map<String, dynamic> params,
651648
Map<String, String> headers,
652649
bool withCredentials: false,

0 commit comments

Comments
 (0)