Hi,
I'm trying to return type text/plain to respond to a certain external API call.
I'm receiving this;
{ "result": "Welcome to Service\nSelect a service.\n1: Register\n2: Help\n#: Exit.", "targetUrl": null, "success": true, "error": null, "unAuthorizedRequest": false, "__abp": true }
But I'd like to receive just this;
Welcome to Service Select a service. 1: Register 2: Help #: Exit
- 9.1
- MVC
- .net core
10 Answer(s)
-
0
Hi,
Is it possible to get help on this?
-
1
Hi alfar_re, You can use the
[DontWrapResultAttribute]
feature on the interface to prohibit ABP from wrapping the return value. -
0
Hi zony,
I did that but I still get the same result.
-
0
Hi alfar_re, I upload a DEMO project later, and the features worked normally in my project.
-
0
Hi,
Do you mean I should try on a different project and see if it works?
-
0
Hi alfar_re, It works in my project.
public class DemoDto { public string Name { get; set; } public int Age { get; set; } } [Route("/api/demo")] public class DemoController : AbpController { [HttpGet] [Route("/abp-wrap-result")] public Task<DemoDto> AbpWrapResultAsync() { return Task.FromResult(new DemoDto { Name = "A", Age = 11 }); } [DontWrapResult] [HttpGet] [Route("/no-wrap-result")] public Task<DemoDto> NoWrapResultAsync() { return Task.FromResult(new DemoDto { Name = "A", Age = 11 }); } }
-
0
Hi @zony,
I see. Thanks for making this clear. Let me try it out.
-
0
Hi @alfar_re
Did you have a chance to try this ?
-
0
Hi @ismcagdas,
Apologies I'd lost track on this. Yes I did, it worked perfectly.
-
0
Great :)