Skip to content

Commit

Permalink
Merge pull request #389 from dchallas/dchallas/ReturnTypeBlob
Browse files Browse the repository at this point in the history
[Angular] Gestion des returnType Blob ArrayBuffer
  • Loading branch information
gideruette authored Sep 6, 2024
2 parents 3cd3f90 + bdb9922 commit 83a2fe1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TopModel.Generator.Javascript/AngularApiClientGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ private void WriteEndpoint(Endpoint endpoint, FileWriter fw)
fw.WriteLine();
}

if (returnType == "string")
if (returnType == "string" || returnType == "Blob" || returnType == "ArrayBuffer")
{
fw.Write(2, $@"return {(Config.ApiMode == TargetFramework.ANGULAR_PROMISE ? "lastValueFrom(" : string.Empty)}this.http.{endpoint.Method.ToLower()}(`/{fullRoute}`");
fw.Write(2, $@"return {(Config.ApiMode == TargetFramework.ANGULAR_PROMISE ? "lastValueFrom(" : string.Empty)}this.http.{endpoint.Method.ToLower()}(`/{fullRoute}`");
}
else
{
Expand All @@ -228,9 +228,9 @@ private void WriteEndpoint(Endpoint endpoint, FileWriter fw)
fw.Write(", {}");
}

if (returnType == "string")
if (returnType == "string" || returnType == "Blob" || returnType == "ArrayBuffer")
{
fw.Write($", {{responseType: 'text'}}");
fw.Write($", {{responseType: '{returnType.ToLower()}'}}");
}

if (endpoint.GetQueryParams().Any())
Expand Down

0 comments on commit 83a2fe1

Please sign in to comment.