ASL
HttpMessage Class Reference

Detailed Description

Base class of HttpRequest and HttpResponse with common functionality.

#include <Http.h>

Inheritance diagram for HttpMessage:
HttpRequest HttpResponse

Public Member Functions

void setHeader (const String &header, const String &value)
 Adds a message header with name header and value value
 
String header (const String &name) const
 Returns the value of the header named.
 
bool hasHeader (const String &name) const
 Returns true if the message includes the given header name.
 
const Stringprotocol () const
 Returns the HTTP protocol (e.g. More...
 
void put (const ByteArray &data)
 Sets the body of the message as a binary blob.
 
void put (const String &body)
 Sets the body of the message as a text string.
 
void put (const Var &data)
 Sets the body of the message as a JSON document.
 
void put (const File &file)
 Sets the body of the message as a file.
 
const ByteArraybody () const
 Returns the binary body of the message.
 
String text () const
 Returns the message body as text.
 
Var json () const
 Returns the message body interpreted as JSON.
 
bool sendHeaders ()
 Sends the currently set headers and starts the message body.
 
void write (const String &text)
 Writes the given text string to the message body.
 
int write (const char *buffer, int n)
 Writes the given buffer to the message body.
 
void writeFile (const String &path, int begin=0, int end=0)
 Sends the content of the given file in the message body.
 
bool putFile (const String &path, int begin=0, int end=0)
 Sends the content of the given file as the message body and sets the content-length header.
 

Member Function Documentation

◆ protocol()

const String& protocol ( ) const
inline

Returns the HTTP protocol (e.g.

"HTTP/1.1")


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