android - 使用不同的路径参数更新 @url 路径
问题描述
Android - retrofit 2.9.0
我有以下改造方法。我正在使用 @Url 来包含基本 url 和搜索产品的路径。但是,我需要将 acode
作为路径的一部分传递。由于我需要包含完整路径,如何将代码添加到完整的 url 路径中?
"https://myBaseUrl/v2/products/{code}/search"
@GET
fun searchProductV2(
@Path("code") storeCode: String,
@Url fullPath: String = "https://myBaseUrl/v2/products/{code}/search",
@Query("searchCriteria[pageSize]") pageSize: String,
@QueryMap apiSearchCriteria: Map<String, String>,
@HeaderMap headerMap: Map<String, String> = emptyMap()
): Single<Products>
解决方案
似乎是明显而简单的解决方案......
@Url fullPath: String = "https://myBaseUrl/v2/products/" +storeCode+ "/search",
推荐阅读
- git - 如何保护文件夹免受服务器上的 git pull 更改
- git - 迁移服务器后,git不显示,做了一个git init,但现在我无法更改为master
- symfony - Symfony 4、PHPUnit Bridge 和 phpunit 位置
- javascript - 选择第一个
聚合物元素 1 - c++ - 从头开始为应用程序创建 docker 映像是否有意义?
- microcontroller - 使用 Openocd 烧写 nrf52 芯片的问题
- javascript - 仅当 AJAX 返回成功时才切换复选框
- sapui5 - 在 sap.ui.table 中选择带有复选框的单行
- python - WRF Lambert Conformal Conic 如何转换为纬度/经度图偏移
- c++ - 使用 boost async_read 和 posix::stream_descriptor 从键盘读取