本文整理汇总了C++中FHttpResponsePtr::GetContentType方法的典型用法代码示例。如果您正苦于以下问题:C++ FHttpResponsePtr::GetContentType方法的具体用法?C++ FHttpResponsePtr::GetContentType怎么用?C++ FHttpResponsePtr::GetContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FHttpResponsePtr
的用法示例。
在下文中一共展示了FHttpResponsePtr::GetContentType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseMessageFromResponse
bool HttpRpcRequest::ParseMessageFromResponse(FHttpResponsePtr response) {
const FString contentType = response->GetContentType();
if (contentType.StartsWith(kContentTypeJson)) {
} else if (contentType.StartsWith(kContentTypeASCII)) {
if (!google::protobuf::TextFormat::ParseFromString(TCHAR_TO_UTF8(*response->GetContentAsString()), callState_.GetResponse())) {
UE_LOG(HttpRpcRequestLog, Error, TEXT("ASCII response parse failed"));
return false;
}
return true;
} else if (contentType.StartsWith(kContentTypeBinary)) {
} else {
UE_LOG(HttpRpcRequestLog, Error, TEXT("Invalid content type '%s'"), *contentType);
}
return false;
}
示例2: OnResponseReceived
void UMasterServerFunctions::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
FString MessageBody = "";
if (!Response.IsValid()) { CurrentRequest.ResponseType = EHttpResponse::HR_NoData; Closed(MessageBody); return; }
if (EHttpResponseCodes::IsOk(Response->GetResponseCode()))
{
if (Response->GetContentType().Equals("application/json"))
{
MessageBody = DecompressBytes(Response->GetContent());
ProcessJSON(MessageBody);
}
}
else
{
MessageBody = FString::Printf(TEXT("{\"success\":\"HTTP Error: %d\"}"), Response->GetResponseCode());
}
Closed(MessageBody);
}