如何修复改造中包含 $ 的查询参数

How to fix Query params containing $ in retrofit

我有一个需要 $ 的查询参数,当我添加带有转义字符的 $ 时,它被转换为 %24

@GET("/ghi/abc/def(FieldId={FieldId},ContentId={ContentId})")
fun getUserGroup(
    @Header("authorization") token: String
    ,@Path("FieldId") fieldId: Long,
     @Path("ContentId") contentId: Long
    , @Query("$filter") filter: String
    , @Query("$skip") skip: String
    , @Query("$top") top: String
    , @Query("$count") count: Boolean

/ghi/abc/def(FieldId=22206,ContentId=346488)?%24filter=contains(tolower(Value),tolower('qwerty'))&%24skip=0&$top=2&%24count =真

这没有错。

%24 is the Url encoded character for $ .

一些特殊字符被一些其他字符替换,这被称为 HTTP URL 编码。

服务器知道它并解码它会正确处理请求。