public:
virtual ~HTTPResponse() {}
+ void setContentType(const char* type) {
+ setResponseHeader("Content-Type", type);
+ }
+
/**
* Sets or clears a response header.
*
* @param name cookie name
* @param value value to set, or NULL to clear
*/
- virtual void setCookie(const char* name, const char* value)=0;
+ virtual void setCookie(const char* name, const char* value) {
+ std::string cookie(name);
+ cookie = cookie + '=' + value;
+ setResponseHeader("Set-Cookie", cookie.c_str());
+ }
/**
* Redirect the client to the specified URL and complete the response.
m_headers[name] = value ? value : "";\r
}\r
\r
- void setContentType(const char* type) {\r
- setResponseHeader("Content-Type", type);\r
- }\r
- \r
- void setCookie(const char* name, const char* value) {\r
- m_headers["Set-Cookie"] = string(name) + "=" + (value ? value : "");\r
- }\r
- \r
// The amount of error checking missing from this is incredible, but as long\r
// as the test data isn't unexpected or malformed, it should work.\r
\r