Skip to content

Public property with private getter is included in URL #462

@Poooel

Description

@Poooel

Hello everybody,

I don't know if this is an issue or a misunderstanding of Refit but here it is:
For some calls to my web service I have an object to be serialized as parameters in the URL. The object has some public properties with public getters and some public properties with private getters. The problem is, when sending a request, the public properties with private getters are sent in the URL.

Here is the object:

public class Page
{
    public int Number { get; set; }
    public int Size { get; set; }
    public string Sort
    {
        get
        {
            return SortMember + "," + (SortDirection == SortDirection.ASC ? "asc" : "desc");
        }
    }

    public string SortMember { private get; set; }
    public SortDirection SortDirection { private get; set; }
} 

Here is the call in the Refit interface:

[Get("")]
Task<Response<Company>> FindAll(string socialReason, Page page);

You can see in this snippet from Fiddler the properties in the URL:
capture

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions