Browse Source
Merge pull request #760 from colinin/fix-api-path
fix(axios): the api path should start with '/'
pull/761/head
yx lin
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
10 additions and
4 deletions
-
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/ServiceProxying/TypeScript/AxiosHttpApiScriptGenerator.cs
-
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/ServiceProxying/TypeScript/UniAppAxiosHttpApiScriptGenerator.cs
-
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/ServiceProxying/TypeScript/VbenAxiosHttpApiScriptGenerator.cs
-
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/ServiceProxying/TypeScript/VbenDynamicHttpApiScriptGenerator.cs
|
|
@ -64,7 +64,7 @@ public class AxiosHttpApiScriptGenerator : IHttpApiScriptGenerator, ITransientDe |
|
|
|
|
|
|
|
|
foreach (var action in actionModel.Actions) |
|
|
foreach (var action in actionModel.Actions) |
|
|
{ |
|
|
{ |
|
|
var url = action.Value.Url; |
|
|
var url = action.Value.Url.EnsureStartsWith('/'); |
|
|
var isFormatUrl = false; |
|
|
var isFormatUrl = false; |
|
|
var formatUrlIndex = 0; |
|
|
var formatUrlIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ public class UniAppAxiosHttpApiScriptGenerator : IHttpApiScriptGenerator, ITrans |
|
|
|
|
|
|
|
|
foreach (var action in actionModel.Actions) |
|
|
foreach (var action in actionModel.Actions) |
|
|
{ |
|
|
{ |
|
|
var url = action.Value.Url; |
|
|
var url = action.Value.Url.EnsureStartsWith('/'); |
|
|
var isFormatUrl = false; |
|
|
var isFormatUrl = false; |
|
|
var formatUrlIndex = 0; |
|
|
var formatUrlIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ public class VbenAxiosHttpApiScriptGenerator : IHttpApiScriptGenerator, ITransie |
|
|
|
|
|
|
|
|
foreach (var action in actionModel.Actions) |
|
|
foreach (var action in actionModel.Actions) |
|
|
{ |
|
|
{ |
|
|
var url = action.Value.Url; |
|
|
var url = action.Value.Url.EnsureStartsWith('/'); |
|
|
var isFormatUrl = false; |
|
|
var isFormatUrl = false; |
|
|
var formatUrlIndex = 0; |
|
|
var formatUrlIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
@ -140,7 +140,13 @@ public class VbenDynamicHttpApiScriptGenerator : IHttpApiScriptGenerator, ITrans |
|
|
var inPathParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Path"); |
|
|
var inPathParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Path"); |
|
|
var inBodyParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Body"); |
|
|
var inBodyParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Body"); |
|
|
|
|
|
|
|
|
if (inPathParams.Any()) |
|
|
if (inPathParams.Any() && |
|
|
|
|
|
inPathParams.Count() == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
apiScriptBuilder.AppendFormat(" params: {0},", inPathParams.First().NameOnMethod); |
|
|
|
|
|
apiScriptBuilder.AppendLine(""); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
apiScriptBuilder.AppendLine(" params: {"); |
|
|
apiScriptBuilder.AppendLine(" params: {"); |
|
|
foreach (var paramter in inPathParams) |
|
|
foreach (var paramter in inPathParams) |
|
|
|