From bdb9922990031ca12faf3099a30f093437bf2965 Mon Sep 17 00:00:00 2001 From: Denis Challas Date: Fri, 6 Sep 2024 14:10:20 +0200 Subject: [PATCH] [Angular] Gestion des returnType Blob ArrayBuffer --- .../AngularApiClientGenerator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TopModel.Generator.Javascript/AngularApiClientGenerator.cs b/TopModel.Generator.Javascript/AngularApiClientGenerator.cs index 1f086d47..c5387f63 100644 --- a/TopModel.Generator.Javascript/AngularApiClientGenerator.cs +++ b/TopModel.Generator.Javascript/AngularApiClientGenerator.cs @@ -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 { @@ -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())