abp icon indicating copy to clipboard operation
abp copied to clipboard

Angular: wrong proxy generated if Dictionary used as input for query params

Open antonGritsenko opened this issue 8 months ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

If Dictionary used as query parameters then wrong proxy generated.

Reproduction Steps

Add method to any service:

public virtual async Task<List<AnyDto>> GetSomeAsync([FromQuery] Dictionary<string, string> searchFields)
{
     return new List<AnyDto> = new();
}

Expected behavior

  some = (searchFields: Record<string, string>, config?: Partial<Rest.Config>) =>
    this.restService.request<any, AnyDto[]>({
      method: 'GET',
      url: '/api/app/my-service/some',
      params: searchFields,
    },
    { apiName: this.apiName,...config });

Actual behavior

  some = (searchFields: Record<string, string>, config?: Partial<Rest.Config>) =>
    this.restService.request<any, AnyDto[]>({
      method: 'GET',
      url: '/api/app/my-service/some',
      params: { searchFields },
    },
    { apiName: this.apiName,...config });

See params, this cause wrong URL, for example for input {prop: "value"} you will get object=[object] in the URL instead prop=value.

Regression?

Not sure

Known Workarounds

No

Version

8.1.1

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

antonGritsenko avatar Jun 24 '24 18:06 antonGritsenko