HttpResponse.h
Go to the documentation of this file.
Represents either an incoming or outgoing response to a HTTP request.
Definition: HttpResponse.h:26
HttpResponse * setHeader(const String &name, const String &value)
Definition: HttpResponse.h:50
bool sendDataStream(IDataSourceStream *newDataStream, enum MimeType type)
Send data from the given stream object.
Definition: HttpResponse.h:85
HttpResponse * setCache(int maxAgeSeconds=3600, bool isPublic=false)
bool sendNamedStream(IDataSourceStream *newDataStream)
Parse and send stream, using the name to determine the content type.
HttpResponse * setCookie(const String &name, const String &value, bool append=false)
bool sendFile(const String &fileName, bool allowGzipFileCheck=true)
Send file by name.
void setBuffer(ReadWriteStream *buffer)
Called by connection to specify where incoming response data is written.
HttpResponse * setContentType(enum MimeType type)
Definition: HttpResponse.h:43
bool sendString(String &&text) noexcept
String toString() const
Tries to present a readable version of the current response values.
ReadWriteStream * buffer
Internal stream for storing strings and receiving responses.
Definition: HttpResponse.h:151
bool sendString(const String &text)
String getBody()
Moves content from the body stream into a String.
Definition: HttpResponse.h:106
bool sendDataStream(IDataSourceStream *newDataStream, const String &reqContentType=nullptr)
Send data from the given stream object.
bool isSuccess()
Determine if the response status indicates success.
Definition: HttpResponse.h:134
HttpResponse * setContentType(const String &type)
Definition: HttpResponse.h:37
HttpResponse * setAllowCrossDomainOrigin(const String &controlAllowOrigin)
Definition: HttpResponse.h:59
virtual bool moveString(String &s)
Memory-based streams may be able to move content into a String.
Definition: DataSourceStream.h:190