You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refit encodes URL [Query] and path segment values automatically, and the only controls are method-level ([QueryUriFormat]) or coarse (TreatAsString). There's no per-parameter way to say "this value is already encoded, pass it through verbatim." This is the feature side of bug #2002 (URL segments getting encoded with no toggle).
Prior art: Retrofit encoded
Retrofit puts an encoded flag on individual parameter annotations — @Query(value, encoded=true), @Path(value, encoded=true), @Field(..., encoded=true), @QueryMap(encoded=true). When set, Retrofit skips URL-encoding for that parameter, letting callers pass pre-encoded values.
Proposal
Add a per-parameter encoding opt-out, e.g. an Encode = false property on [Query] (and a path equivalent), so a single value can bypass automatic encoding while the rest of the request encodes normally. Resolves #2002.
Considerations
Interaction with UrlResolutionMode (RefitLegacy vs Rfc3986) and QueryUriFormatAttribute — define precedence (per-param should win).
Summary
Refit encodes URL
[Query]and path segment values automatically, and the only controls are method-level ([QueryUriFormat]) or coarse (TreatAsString). There's no per-parameter way to say "this value is already encoded, pass it through verbatim." This is the feature side of bug #2002 (URL segments getting encoded with no toggle).Prior art: Retrofit
encodedRetrofit puts an
encodedflag on individual parameter annotations —@Query(value, encoded=true),@Path(value, encoded=true),@Field(..., encoded=true),@QueryMap(encoded=true). When set, Retrofit skips URL-encoding for that parameter, letting callers pass pre-encoded values.Proposal
Add a per-parameter encoding opt-out, e.g. an
Encode = falseproperty on[Query](and a path equivalent), so a single value can bypass automatic encoding while the rest of the request encodes normally. Resolves #2002.Considerations
UrlResolutionMode(RefitLegacy vs Rfc3986) andQueryUriFormatAttribute— define precedence (per-param should win).Acceptance criteria
Pointers
src/Refit/RequestBuilderImplementation.RequestBuilding.cs,RequestBuilderImplementation.QueryAndHeaders.cs.src/Refit/QueryAttribute.cs(TreatAsString,Format),src/Refit/QueryUriFormatAttribute.cs.~/square/retrofit/retrofit/src/main/java/retrofit2/http/{Query,Path,Field}.java.