ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::FormRequest Class Reference

A Custom Base HTTP Request. More...

#include <FormRequest.h>

Inheritance diagram for ofx::HTTP::FormRequest:
ofx::HTTP::Request ofx::HTTP::GetRequest ofx::HTTP::HeadRequest ofx::HTTP::PostRequest ofx::HTTP::PutRequest

Public Member Functions

virtual ~FormRequest ()
 Destroy this BaseReuqest.
 
void addFormField (const std::string &name, const std::string &value)
 Add a name value pair to upload with this request. More...
 
void setFormField (const std::string &name, const std::string &value)
 Set a name value pair to upload with this request. More...
 
void addFormFields (const Poco::Net::NameValueCollection &formFields)
 Add additional form fields. More...
 
void addFormFields (const std::multimap< std::string, std::string > &formFields)
 Add additional form fields. More...
 
void clearFormFields ()
 Clear all form fields.
 
- Public Member Functions inherited from ofx::HTTP::Request
 Request (const std::string &method, const std::string &uri, const std::string &httpVersion)
 Construct an Request. More...
 
virtual ~Request ()
 Destroy this Request.
 
virtual void write (std::ostream &ostr) const
 Write the HTTPRequest to an output stream. More...
 
void setRequestId (const std::string &requestId)
 Set the id of the request. More...
 
const std::string & getRequestId () const
 Get the id of the request. More...
 
const Poco::Net::HTMLForm & form () const
 Get a const reference to the raw form data. More...
 
int64_t estimatedContentLength () const
 Get the estimated content length for progress estimation purposes. More...
 

Static Public Attributes

static const std::string DEFAULT_MEDIA_TYPE = "application/octet-stream"
 The default MIME type.
 

Friends

class BaseClient
 A friend class.
 

Additional Inherited Members

- Static Public Member Functions inherited from ofx::HTTP::Request
static std::string generateId ()
 Generate a UUID string. More...
 
- Protected Member Functions inherited from ofx::HTTP::Request
virtual void prepareRequest ()
 Prepare the current request.
 
virtual void writeRequestBody (std::ostream &requestStream)
 Write the body of the request. More...
 
- Protected Attributes inherited from ofx::HTTP::Request
std::string _requestId
 The original URI passed in during construction. More...
 
Poco::Net::HTMLForm _form
 A form with all query terms / form parameters. More...
 

Detailed Description

A Custom Base HTTP Request.

Member Function Documentation

◆ addFormField()

void ofx::HTTP::FormRequest::addFormField ( const std::string &  name,
const std::string &  value 
)

Add a name value pair to upload with this request.

When form fields are added to anything other then POST and PUT requests, the form fields will be converted to query parameters and appended to the URI before request submission.

Parameters
nameThe field name.
valueThe field value.

◆ addFormFields() [1/2]

void ofx::HTTP::FormRequest::addFormFields ( const Poco::Net::NameValueCollection &  formFields)

Add additional form fields.

When form fields are added to anything other then POST and PUT requests, the form fields will be converted to query parameters and appended to the URI before request submission.

Parameters
formFieldsThe form fields to add.

◆ addFormFields() [2/2]

void ofx::HTTP::FormRequest::addFormFields ( const std::multimap< std::string, std::string > &  formFields)

Add additional form fields.

When form fields are added to anything other then POST and PUT requests, the form fields will be converted to query parameters and appended to the URI before request submission.

Parameters
formFieldsThe form fields to add.

◆ setFormField()

void ofx::HTTP::FormRequest::setFormField ( const std::string &  name,
const std::string &  value 
)

Set a name value pair to upload with this request.

When form fields are added to anything other then POST and PUT requests, the form fields will be converted to query parameters and appended to the URI before request submission.

Parameters
nameThe field name.
valueThe field value.

The documentation for this class was generated from the following files: