Skip to content

Commit f1ee1cb

Browse files
authored
[cpp-ue4] Updated generator to return the http request so that it can be canceled or further manipulated. (#9693)
1 parent cce0d0a commit f1ee1cb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

modules/openapi-generator/src/main/resources/cpp-ue4/api-header.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public:
3535
{{#operations}}{{#operation}}DECLARE_DELEGATE_OneParam(F{{operationIdCamelCase}}Delegate, const {{operationIdCamelCase}}Response&);
3636
{{/operation}}{{/operations}}
3737
{{#operations}}{{#operation}}{{#description}}/* {{{description}}} */
38-
{{/description}}bool {{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate = F{{operationIdCamelCase}}Delegate()) const;
38+
{{/description}}FHttpRequestPtr {{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate = F{{operationIdCamelCase}}Delegate()) const;
3939
{{/operation}}{{/operations}}
4040
private:
4141
{{#operations}}{{#operation}}void On{{operationIdCamelCase}}Response(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, F{{operationIdCamelCase}}Delegate Delegate) const;

modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ void {{classname}}::HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceede
125125

126126
{{#operations}}
127127
{{#operation}}
128-
bool {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate /*= F{{operationIdCamelCase}}Delegate()*/) const
128+
FHttpRequestPtr {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate /*= F{{operationIdCamelCase}}Delegate()*/) const
129129
{
130130
if (!IsValid())
131-
return false;
131+
return nullptr;
132132
133133
FHttpRequestRef HttpRequest = CreateHttpRequest(Request);
134134
HttpRequest->SetURL(*(Url + Request.ComputePath()));
@@ -141,7 +141,8 @@ bool {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Reque
141141
Request.SetupHttpRequest(HttpRequest);
142142

143143
HttpRequest->OnProcessRequestComplete().BindRaw(this, &{{classname}}::On{{operationIdCamelCase}}Response, Delegate);
144-
return HttpRequest->ProcessRequest();
144+
HttpRequest->ProcessRequest();
145+
return HttpRequest;
145146
}
146147

147148
void {{classname}}::On{{operationIdCamelCase}}Response(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, F{{operationIdCamelCase}}Delegate Delegate) const

0 commit comments

Comments
 (0)