1

If you're using a Dart HttpClient (which provides an HttpClientRequest) to make requests from a server to another server, as far as I can tell the only HTTP methods available are GET and POST (corresponding, respectively, to the post/postUrl and get/getUrl functions). Is there also a way to make PUT and DELETE requests?

lucperkins
  • 768
  • 1
  • 7
  • 15

1 Answers1

5

You should be able to do with this with the open method which allows you to use any HTTP verb:

client.open('delete', 'http://example.com', '8080', '/test');

If you look at the HttpClient source you'll see that the get and post methods are just aliases for open anyway:

Future<HttpClientRequest> post(String host,
                                 int port,
                                 String path) {
    return open("post", host, port, path);
}
Pixel Elephant
  • 20,649
  • 9
  • 66
  • 83