Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: lib/http.dart

Issue 1243783002: Add a shortcut for PATCH. (Closed) Base URL: git@github.com:dart-lang/http@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/base_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/http.dart
diff --git a/lib/http.dart b/lib/http.dart
index 5b9b1f9bb6d97b7aeae9ae70601b56584b6bb99a..0fbd11b2881d71bdc944f683e8ed60a5707a37bc 100644
--- a/lib/http.dart
+++ b/lib/http.dart
@@ -96,6 +96,30 @@ Future<Response> put(url, {Map<String, String> headers, body,
_withClient((client) => client.put(url,
headers: headers, body: body, encoding: encoding));
+/// Sends an HTTP PATCH request with the given headers and body to the given
+/// URL, which can be a [Uri] or a [String].
+///
+/// [body] sets the body of the request. It can be a [String], a [List<int>] or
+/// a [Map<String, String>]. If it's a String, it's encoded using [encoding] and
+/// used as the body of the request. The content-type of the request will
+/// default to "text/plain".
+///
+/// If [body] is a List, it's used as a list of bytes for the body of the
+/// request.
+///
+/// If [body] is a Map, it's encoded as form fields using [encoding]. The
+/// content-type of the request will be set to
+/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
+///
+/// [encoding] defaults to [UTF8].
+///
+/// For more fine-grained control over the request, use [Request] or
+/// [StreamedRequest] instead.
+Future<Response> patch(url, {Map<String, String> headers, body,
+ Encoding encoding}) =>
+ _withClient((client) => client.patch(url,
+ headers: headers, body: body, encoding: encoding));
+
/// Sends an HTTP DELETE request with the given headers to the given URL, which
/// can be a [Uri] or a [String].
///
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/base_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698