Skip to content

Commit

Permalink
fix(lib): Allow a body for DELETE requests
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectlyNormal committed Dec 2, 2024
1 parent e71421e commit c882849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add annotations package to further customize output (#107)
- Support for .NET9

### Fixed

- Send request bodies on DELETE requests even though they should not be used

### Changed

- Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0
Expand Down
2 changes: 1 addition & 1 deletion TypeContractor/TypeScript/ApiClientWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public string Write(ApiClient apiClient, IEnumerable<OutputType> allTypes, TypeS
}
}

var requiresBody = endpoint.Method is EndpointMethod.POST or EndpointMethod.PUT or EndpointMethod.PATCH;
var requiresBody = endpoint.Method is EndpointMethod.POST or EndpointMethod.PUT or EndpointMethod.PATCH or EndpointMethod.DELETE;
var body = endpoint.Parameters.FirstOrDefault(p => p.FromBody || (!p.FromRoute && !p.FromQuery));

var returnUnparsedResponse = endpoint.UnwrappedReturnType is null && endpoint.ReturnType is null;
Expand Down

0 comments on commit c882849

Please sign in to comment.