diff --git a/src/app/Common.cpp b/src/app/Common.cpp index d90fe08..816dce6 100644 --- a/src/app/Common.cpp +++ b/src/app/Common.cpp @@ -86,6 +86,20 @@ namespace Apostol { } //-------------------------------------------------------------------------------------------------------------- + CHTTPRequest::CContentType CCustomModule::StringToContentType(const CString &ContentType) { + if (ContentType == "application/json") { + return CHTTPRequest::json; + } else if (ContentType == "text/html") { + return CHTTPRequest::html; + } else if (ContentType == "application/xml") { + return CHTTPRequest::xml; + } else if (ContentType == "application/octet-stream") { + return CHTTPRequest::sbin; + } + return CHTTPRequest::text; + } + //-------------------------------------------------------------------------------------------------------------- + CString CCustomModule::ToString(unsigned long Value) { TCHAR szString[_INT_T_LEN + 1] = {0}; sprintf(szString, "%lu", Value); diff --git a/src/app/Common.hpp b/src/app/Common.hpp index dd8fbe5..826d8af 100644 --- a/src/app/Common.hpp +++ b/src/app/Common.hpp @@ -143,6 +143,7 @@ namespace Apostol { static void UpdateOAuth2(CContext &Context, const CJSONObject &OAuth2); static void UpdateProviders(CProviders &Providers, const CJSONObject &Data); + static CHTTPRequest::CContentType StringToContentType(const CString &ContentType); }; }