Links
- io/http.dart
Future<HttpClientRequest> post(String host, int port, String path)
Future<HttpClientRequest> postUrl(Uri url)
Examples
POST from a command line app
import 'dart:io'; import 'dart:convert' show UTF8, JSON; main() { Uri url = Uri.parse("http://ng-dash.gae.localhost/api/run"); new HttpClient().postUrl(url) .then((HttpClientRequest request) { request.headers.contentType = ContentType.JSON; request.write(JSON.encode({"commitSha": "d1"})); return request.close(); }) .then((HttpClientResponse response) { response.transform(UTF8.decoder).listen((contents) { print(contents); }); }); }