Possible bug: Incorrect mapping IActionResult -> FileResponse
See original GitHub issueHi, I have a ASP.NET Core Web API action as follows:
[HttpPost("RemoveAccessRights")]
public async Task<IActionResult> RemoveAccessRights([FromBody]List<CreateOrUpdateUserAccessDto> input)
{
// Get vbc workspace
var workspace = GetWorkspace();
foreach (var record in input)
{
await Task.Run(() => RemoveUserAccessRights(record, workspace));
}
return Ok();
}
The swagger json is:
"/api/Users/RemoveAccessRights": {
"post": {
"tags": [
"Users"
],
"operationId": "Users_RemoveAccessRights",
"parameters": [
{
"name": "input",
"in": "body",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/CreateOrUpdateUserAccessDto"
}
},
"x-nullable": true
}
],
"responses": {
"200": {
"description": "",
"schema": {
"type": "file"
},
"x-nullable": true
}
}
}
},
The client-side generation is:
public removeAccessRights(input: CreateOrUpdateUserAccessDto[]): Observable<FileResponse> {}
How come IActionResult is transformed to FileResponse?
Thanks Bilal
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Incorrect mapping IActionResult -> FileResponse · Issue # ...
Possible bug : Incorrect mapping IActionResult -> FileResponse #1030 ... return type is IActionResult it does not know what the response type ...
Read more >Returning a file to View/Download in ASP.NET MVC
I'm encountering a problem sending files stored in a database back to the user in ASP.NET MVC. What I want is a view...
Read more >Format response data in ASP.NET Core Web API
Learn how to format response data in ASP.NET Core Web API.
Read more >Lee's Blog - RSSing.com
On a good googlefu day I stumbled on the solution of telling Swashbuckle to map all instances of FileContentResult with "file" in startup.cs ......
Read more >[Fix]-Can form submit file(s) to ASP.NET Core controller action ...
Coding example for the question Can form submit file(s) to ASP.NET Core controller action without knowing field name in advance?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Add
Thank you for logging this issue. It saved me a ton of time.