KanoopProtocolQt 1.2.3
Qt HTTP operations and MQTT client library
Loading...
Searching...
No Matches
httpdelete.h
1#ifndef HTTPDELETE_H
2#define HTTPDELETE_H
3#include <Kanoop/http/httpoperation.h>
4#include <Kanoop/serialization/iserializabletojson.h>
5
6/** @brief HTTP DELETE operation executed asynchronously on a dedicated thread. */
7class LIBKANOOPPROTOCOL_EXPORT HttpDelete : public HttpOperation
8{
9 Q_OBJECT
10public:
11 /** @brief Construct an HTTP DELETE operation with an optional raw body.
12 * @param url The target URL.
13 * @param postBody The raw body data to include with the DELETE request. */
14 HttpDelete(const QString& url, const QByteArray& postBody = QByteArray()) :
15 HttpOperation(url, Delete),
16 _postBody(postBody) {}
17
18 /** @brief Construct an HTTP DELETE operation with a JSON-serializable body.
19 * @param url The target URL.
20 * @param postBody The object to serialize to JSON for the DELETE body. */
21 HttpDelete(const QString& url, const ISerializableToJson& postBody) :
22 HttpOperation(url, Delete),
23 _postBody(postBody.serializeToJson()), _isJson(true) {}
24
25protected:
26 /** @brief Execute the HTTP DELETE request. */
27 virtual void execute() override;
28
29 /** @brief Hook called before the DELETE request is sent. */
30 virtual void preDeleteHook() {}
31
32 /** @brief Hook called after the DELETE reply is received. */
33 virtual void postDeleteHook() {}
34
35private:
36 QByteArray _postBody;
37 bool _isJson = false;
38};
39
40#endif // HTTPDELETE_H
HTTP DELETE operation executed asynchronously on a dedicated thread.
Definition httpdelete.h:8
HttpDelete(const QString &url, const QByteArray &postBody=QByteArray())
Construct an HTTP DELETE operation with an optional raw body.
Definition httpdelete.h:14
virtual void postDeleteHook()
Hook called after the DELETE reply is received.
Definition httpdelete.h:33
HttpDelete(const QString &url, const ISerializableToJson &postBody)
Construct an HTTP DELETE operation with a JSON-serializable body.
Definition httpdelete.h:21
virtual void preDeleteHook()
Hook called before the DELETE request is sent.
Definition httpdelete.h:30
virtual void execute() override
Execute the HTTP DELETE request.
Base class for HTTP operations executed asynchronously on a dedicated thread.