How can DELETE requests be made with a Dart HttpClient?

后端 未结 1 797
暗喜
暗喜 2021-01-24 19:38

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 onl

相关标签:
1条回答
  • 2021-01-24 20:07

    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);
    }
    
    0 讨论(0)
提交回复
热议问题