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

Commit 68c3e80

Browse files
committed
fix(Http): Auxiliary methods like get, put, post, etc. do not set type restriction on data being sent.
Fixes #1051
1 parent 5b48332 commit 68c3e80

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Diff for: lib/core_dom/http.dart

+7-10
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ class Http {
424424
async.Future<HttpResponse> call({
425425
String url,
426426
String method,
427-
data,
427+
dynamic data,
428428
Map<String, dynamic> params,
429429
Map<String, dynamic> headers,
430430
bool withCredentials: false,
@@ -458,8 +458,6 @@ class Http {
458458
});
459459

460460
var serverRequest = (HttpResponseConfig config) {
461-
assert(config.data == null || config.data is String || config.data is dom.File);
462-
463461
// Strip content-type if data is undefined
464462
if (config.data == null) {
465463
new List.from(headers.keys)
@@ -539,7 +537,6 @@ class Http {
539537
* of parameters.
540538
*/
541539
async.Future<HttpResponse> get(String url, {
542-
String data,
543540
Map<String, dynamic> params,
544541
Map<String, String> headers,
545542
bool withCredentials: false,
@@ -548,7 +545,7 @@ class Http {
548545
interceptors,
549546
cache,
550547
timeout
551-
}) => call(method: 'GET', url: url, data: data, params: params, headers: headers,
548+
}) => call(method: 'GET', url: url, data: null, params: params, headers: headers,
552549
withCredentials: withCredentials, xsrfHeaderName: xsrfHeaderName,
553550
xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache: cache,
554551
timeout: timeout);
@@ -558,7 +555,7 @@ class Http {
558555
* of parameters.
559556
*/
560557
async.Future<HttpResponse> delete(String url, {
561-
String data,
558+
dynamic data,
562559
Map<String, dynamic> params,
563560
Map<String, String> headers,
564561
bool withCredentials: false,
@@ -577,7 +574,7 @@ class Http {
577574
* of parameters.
578575
*/
579576
async.Future<HttpResponse> head(String url, {
580-
String data,
577+
dynamic data,
581578
Map<String, dynamic> params,
582579
Map<String, String> headers,
583580
bool withCredentials: false,
@@ -595,7 +592,7 @@ class Http {
595592
* Shortcut method for PUT requests. See [call] for a complete description
596593
* of parameters.
597594
*/
598-
async.Future<HttpResponse> put(String url, String data, {
595+
async.Future<HttpResponse> put(String url, dynamic data, {
599596
Map<String, dynamic> params,
600597
Map<String, String> headers,
601598
bool withCredentials: false,
@@ -613,7 +610,7 @@ class Http {
613610
* Shortcut method for POST requests. See [call] for a complete description
614611
* of parameters.
615612
*/
616-
async.Future<HttpResponse> post(String url, String data, {
613+
async.Future<HttpResponse> post(String url, dynamic data, {
617614
Map<String, dynamic> params,
618615
Map<String, String> headers,
619616
bool withCredentials: false,
@@ -632,7 +629,7 @@ class Http {
632629
* of parameters.
633630
*/
634631
async.Future<HttpResponse> jsonp(String url, {
635-
String data,
632+
dynamic data,
636633
Map<String, dynamic> params,
637634
Map<String, String> headers,
638635
bool withCredentials: false,

0 commit comments

Comments
 (0)