mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 12:17:04 +00:00
[cpp-ue4] Added UE4.26 support, (#8964)
* [cpp-ue4] Fixed enum values not being quoted. I'm not sure when this started breaking. * [cpp-ue4] UE 4.26 Compatibility: Replaced TSharedRef<IHttpRequest by FHttpRequestRef for better portability * [cpp-ue4] Improved DateTime parsing * [cpp-ue4] Made HttpFileInput constructors explicit * [cpp-ue4] Added the possibility to retry requests easily with AsyncRetry method on the response and SetAutoRetryCount on the request WIP auto retry [cpp-ue4] Adds support for instant retry * [cpp-ue4] Using TaskGraph instead of TaskGraphMainThread for async retries * update samples * remove trailing spaces Co-authored-by: Jean-Noel Gourdol <jngourdol@stormancer.com> Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -79,7 +79,7 @@ const FString& HttpMultipartFormData::GetBoundary() const
|
||||
return Boundary;
|
||||
}
|
||||
|
||||
void HttpMultipartFormData::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest)
|
||||
void HttpMultipartFormData::SetupHttpRequest(const FHttpRequestRef& HttpRequest)
|
||||
{
|
||||
if(HttpRequest->GetVerb() != TEXT("POST"))
|
||||
{
|
||||
@@ -192,4 +192,42 @@ void HttpMultipartFormData::AppendString(const TCHAR* Str)
|
||||
FormData.Append((uint8*)utf8Str.Get(), utf8Str.Length());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool ParseDateTime(const FString& DateTimeString, FDateTime& OutDateTime)
|
||||
{
|
||||
// Iso8601 Format: DateTime: YYYY-mm-ddTHH:MM:SS(.sss)(Z|+hh:mm|+hhmm|-hh:mm|-hhmm)
|
||||
{
|
||||
// We cannot call directly FDateTime::ParseIso8601 because it does not allow for precision beyond the millisecond, but DateTimeString might have more digits
|
||||
int32 DotIndex;
|
||||
FString StringToParse = DateTimeString;
|
||||
if (DateTimeString.FindChar('.', DotIndex))
|
||||
{
|
||||
int32 TimeZoneIndex;
|
||||
if (DateTimeString.FindChar('Z', TimeZoneIndex) || DateTimeString.FindChar('+', TimeZoneIndex) || DateTimeString.FindChar('-', TimeZoneIndex))
|
||||
{
|
||||
// The string contains a time zone designator starting at TimeZoneIndex
|
||||
if (TimeZoneIndex > DotIndex + 4)
|
||||
{
|
||||
// Trim to millisecond
|
||||
StringToParse = DateTimeString.Left(DotIndex + 4) + DateTimeString.RightChop(TimeZoneIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// the string does not contain a time zone designator, trim it to the millisecond
|
||||
StringToParse = DateTimeString.Left(DotIndex + 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (FDateTime::ParseIso8601(*StringToParse, OutDateTime))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (FDateTime::ParseHttpDate(DateTimeString, OutDateTime))
|
||||
return true;
|
||||
|
||||
return FDateTime::Parse(DateTimeString, OutDateTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user