Browse Source
Merge pull request #6352 from abpframework/maliming/dataType
Set dataType to text for string return values for dynamic JavaScript proxies.
pull/6410/head
liangshiwei
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
6 deletions
-
framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs
|
|
@ -99,9 +99,12 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery |
|
|
AddAjaxCallParameters(script, action); |
|
|
AddAjaxCallParameters(script, action); |
|
|
|
|
|
|
|
|
var ajaxParamsIsFromForm = action.Parameters.Any(x => x.BindingSourceId == ParameterBindingSources.Form); |
|
|
var ajaxParamsIsFromForm = action.Parameters.Any(x => x.BindingSourceId == ParameterBindingSources.Form); |
|
|
|
|
|
var dataType = action.ReturnValue.Type == ReturnValueApiDescriptionModel.Create(typeof(string)).Type |
|
|
|
|
|
? "{ dataType: 'text' }, " |
|
|
|
|
|
: string.Empty; |
|
|
script.AppendLine(ajaxParamsIsFromForm |
|
|
script.AppendLine(ajaxParamsIsFromForm |
|
|
? " }, $.extend(true, {}, ajaxParams, { contentType: 'application/x-www-form-urlencoded; charset=UTF-8' })));" |
|
|
? " }, $.extend(true, {}, " + dataType + "{ contentType: 'application/x-www-form-urlencoded; charset=UTF-8' }, ajaxParams)));" |
|
|
: " }, ajaxParams));"); |
|
|
: " }, " + dataType + "ajaxParams));"); |
|
|
|
|
|
|
|
|
script.AppendLine(" };"); |
|
|
script.AppendLine(" };"); |
|
|
} |
|
|
} |
|
|
|