+
+ /**
+ *
+ */
+ StringMap& requestHeaders() { return _request_headers; }
+ const StringMap& requestHeaders() const { return _request_headers; }
+ std::string& requestHeader(const std::string& key)
+ { return _request_headers[key]; }
+ const std::string requestHeader(const std::string& key) const
+ { return _request_headers.get(key); }
+
+ /**
+ * Add a handler to be called when the request successfully completes.
+ *
+ * @note If the request is already complete, the handler is called
+ * immediately.
+ */
+ Request* done(const Callback& cb);
+
+ template<class C>
+ Request* done(C* instance, void (C::*mem_func)(Request*))
+ {
+ return done(boost::bind(mem_func, instance, _1));
+ }
+
+ /**
+ * Add a handler to be called when the request completes or aborts with an
+ * error.
+ *
+ * @note If the request has already failed, the handler is called
+ * immediately.
+ */
+ Request* fail(const Callback& cb);
+
+ template<class C>
+ Request* fail(C* instance, void (C::*mem_func)(Request*))
+ {
+ return fail(boost::bind(mem_func, instance, _1));
+ }
+
+ /**
+ * Add a handler to be called when the request either successfully completes
+ * or fails.
+ *
+ * @note If the request is already complete or has already failed, the
+ * handler is called immediately.
+ */
+ Request* always(const Callback& cb);
+
+ template<class C>
+ Request* always(C* instance, void (C::*mem_func)(Request*))
+ {
+ return always(boost::bind(mem_func, instance, _1));
+ }
+
+ /**
+ * Set the data for the body of the request. The request is automatically
+ * send using the POST method.
+ *
+ * @param data Body data
+ * @param type Media Type (aka MIME) of the body data
+ */
+ void setBodyData( const std::string& data,
+ const std::string& type = "text/plain" );
+ void setBodyData( const SGPropertyNode* data );
+