Skip to content

Commit

Permalink
fix(Http): Auxiliary methods like get, put, post, etc. do not set typ…
Browse files Browse the repository at this point in the history
…e restriction on data being sent.

Fixes dart-archive#1051
  • Loading branch information
mvuksano authored and Diana Salsbury committed Jul 16, 2014
1 parent abc3027 commit f94a9d0
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/core_dom/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class Http {
async.Future<HttpResponse> call({
String url,
String method,
data,
dynamic data,
Map<String, dynamic> params,
Map<String, dynamic> headers,
bool withCredentials: false,
Expand Down Expand Up @@ -458,8 +458,6 @@ class Http {
});

var serverRequest = (HttpResponseConfig config) {
assert(config.data == null || config.data is String || config.data is dom.File);

// Strip content-type if data is undefined
if (config.data == null) {
new List.from(headers.keys)
Expand Down Expand Up @@ -539,7 +537,6 @@ class Http {
* of parameters.
*/
async.Future<HttpResponse> get(String url, {
String data,
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand All @@ -548,7 +545,7 @@ class Http {
interceptors,
cache,
timeout
}) => call(method: 'GET', url: url, data: data, params: params, headers: headers,
}) => call(method: 'GET', url: url, data: null, params: params, headers: headers,
withCredentials: withCredentials, xsrfHeaderName: xsrfHeaderName,
xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache: cache,
timeout: timeout);
Expand All @@ -558,7 +555,7 @@ class Http {
* of parameters.
*/
async.Future<HttpResponse> delete(String url, {
String data,
dynamic data,
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand All @@ -577,7 +574,7 @@ class Http {
* of parameters.
*/
async.Future<HttpResponse> head(String url, {
String data,
dynamic data,
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand All @@ -595,7 +592,7 @@ class Http {
* Shortcut method for PUT requests. See [call] for a complete description
* of parameters.
*/
async.Future<HttpResponse> put(String url, String data, {
async.Future<HttpResponse> put(String url, dynamic data, {
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand All @@ -613,7 +610,7 @@ class Http {
* Shortcut method for POST requests. See [call] for a complete description
* of parameters.
*/
async.Future<HttpResponse> post(String url, String data, {
async.Future<HttpResponse> post(String url, dynamic data, {
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand All @@ -632,7 +629,7 @@ class Http {
* of parameters.
*/
async.Future<HttpResponse> jsonp(String url, {
String data,
dynamic data,
Map<String, dynamic> params,
Map<String, String> headers,
bool withCredentials: false,
Expand Down

0 comments on commit f94a9d0

Please sign in to comment.