Allow to cancel asynchronous HTTP requests (#332)

Usage:

	auto args = this->httpClient.createRequest(url, method);
	httpClient.performRequest(args, ...);
	[...]
	// Oops, we don't actually want to complete the request!
	args->cancel = true;
This commit is contained in:
Martin Natano
2021-12-21 08:01:55 +01:00
committed by GitHub
parent 688f85fda6
commit 66cd29e747
4 changed files with 81 additions and 11 deletions

View File

@ -517,6 +517,9 @@ bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response)
);
// ok will be false if your httpClient is not async
// A request in progress can be cancelled by setting the cancel flag. It does nothing if the request already completed.
args->cancel = true;
```
See this [issue](https://github.com/machinezone/IXWebSocket/issues/209) for links about uploading files with HTTP multipart.