Starts in:
2 DAYS
5 HRS
29 MIN
35 SEC
Starts in:
2 D
5 H
29 M
35 S
Open Closed

abp generate-proxy doesn't support mvc FromHeader attribute. #1631


User avatar
0
tomasz.lewandowski@neuca.pl created

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)
  • User Avatar
    0
    Mehmet created

    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!

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06