From b55735d67c3917e97f51a939c8c58f7c5e2d3be3 Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" <nweiz@google.com> Date: Thu, 14 Mar 2013 22:39:14 +0000 Subject: [PATCH] Fix some analyzer warnings in pub. Review URL: https://codereview.chromium.org//12820009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@20057 260f80e4-7a28-3924-810f-c04153c831b5 --- lib/src/http.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/src/http.dart b/lib/src/http.dart index b66f28d7..bd68b456 100644 --- a/lib/src/http.dart +++ b/lib/src/http.dart @@ -90,21 +90,23 @@ class PubHttpClient extends http.BaseClient { var contentTypeString = request.headers[HttpHeaders.CONTENT_TYPE]; if (contentTypeString == null) contentTypeString = ''; var contentType = new ContentType.fromString(contentTypeString); - if (contentType.value == 'application/x-www-form-urlencoded') { - requestLog.writeln(''); - requestLog.writeln("Body fields:"); - request.bodyFields.forEach((name, value) => - requestLog.writeln(_logField(name, value))); - } else if (contentType.value == 'text/plain' || - contentType.value == 'application/json') { - requestLog.write(request.body); - } else if (request is http.MultipartRequest) { + if (request is http.MultipartRequest) { requestLog.writeln(''); requestLog.writeln("Body fields:"); request.fields.forEach((name, value) => requestLog.writeln(_logField(name, value))); // TODO(nweiz): make MultipartRequest.files readable, and log them? + } else if (request is http.Request) { + if (contentType.value == 'application/x-www-form-urlencoded') { + requestLog.writeln(''); + requestLog.writeln("Body fields:"); + request.bodyFields.forEach((name, value) => + requestLog.writeln(_logField(name, value))); + } else if (contentType.value == 'text/plain' || + contentType.value == 'application/json') { + requestLog.write(request.body); + } } } -- GitLab