2016-08-25 58 views
1

好day.I希望得到這樣http//:www.someurl.com/someRedirect/anotherRedirect/?searchCriteria追加問號網址改造Android的

問題的URL的是,我不能問號追加到改裝,如果我不喜歡這樣

@GET("someRedirect/anotherRedirect/{searchCriteria}") 
    Call<ResponseBody> getProductsList(@Path("searchCriteria") String appendedUrl); 

並調用此方法追加?標記,這將只是把一些奇怪%3FB什麼的,如果我不喜歡這樣

@GET("someRedirect/anotherRedirect/") 
    Call<ResponseBody> getProductsList(@Query("searchCriteria") String appendedUrl); 

改裝將使得像http//:www.someurl.com/someRedirect/anotherRedirect/?searchCriteria=searchCriteria鏈接...這到底是不對的圖書館嗎?如何簡單地建立我期望的網址?

回答

1

您使用的是Retrofit 1還是2?無論如何,默認情況下,Retrofit URL編碼路徑。您可以很容易地禁用它:

如果您使用1,那麼您應該使用@EncodedPath而不是@Path

如果您使用2,那麼您應該使用@Path(value = "searchCriteria", encoded = true)

+0

使用第二,好吧讓我試試 –

+0

嗯,沒有成功stil ... –

+0

再次嘗試更多的選擇,但我認爲你的想法是解決的 –