If I create in a mvc controller method with a header parameter, then abp generate-proxy generate that parameter in proxy but won't use it. In my sample problematic parameter is named "expected-version".
- ABP Framework version: v4.3.3
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace: no exception
- Steps to reproduce the issue:"
Mvc method: [HttpPut("{offerId:guid}/make-ready")] public async Task MakeOfferReady( [FromRoute] Guid offerId, [FromHeader(Name = "expected-version")] int expectedVersion) { ... }
Angular proxy method
makeOfferReadyByOfferIdAndExpectedVersion = (offerId: string, expectedVersion: number) =>
this.restService.request<any, NoContentResult>({
method: 'PUT',
url: /api/offers/${offerId}/make-ready
,
},
{ apiName: this.apiName });
2 Answer(s)
-
0
Hi,
Unfortunately, ABP generate proxy does not support the HTTP headers. You can modify the generated method like this:
makeOfferReadyByOfferIdAndExpectedVersion = (offerId: string, expectedVersion: number) => this.restService.request<any, NoContentResult>({ method: 'PUT', url: /api/offers/${offerId}/make-ready, headers: { "expected-version": expectedVersion } }, { apiName: this.apiName });
Please note that your changes in this service will be removed if you regenerate the proxies for the same module. It might be good to move this service from the proxy folder to a different folder.
We will improve the generate proxy for the headers. Thanks!
-
0
This question has been automatically marked as stale because it has not had recent activity.