Added StringToContentType.

This commit is contained in:
Преподобный Ален
2022-10-20 16:05:23 +03:00
parent cf7bdf650d
commit be0f953a55
2 changed files with 15 additions and 0 deletions

View File

@@ -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) { CString CCustomModule::ToString(unsigned long Value) {
TCHAR szString[_INT_T_LEN + 1] = {0}; TCHAR szString[_INT_T_LEN + 1] = {0};
sprintf(szString, "%lu", Value); sprintf(szString, "%lu", Value);

View File

@@ -143,6 +143,7 @@ namespace Apostol {
static void UpdateOAuth2(CContext &Context, const CJSONObject &OAuth2); static void UpdateOAuth2(CContext &Context, const CJSONObject &OAuth2);
static void UpdateProviders(CProviders &Providers, const CJSONObject &Data); static void UpdateProviders(CProviders &Providers, const CJSONObject &Data);
static CHTTPRequest::CContentType StringToContentType(const CString &ContentType);
}; };
} }