Saturday, 19 January 2019

format @Query parameter - Retrofit 2

I switched to using Retrofit2 and everything is nice and clean... But there is a service call that requires that a query parameter be inside a regular expression(don't ask me why, I already asked for it to be changed).

Here is how my method looks like:

@GET("prod/search")
fun searchProducts(@Query("q") q: String?): Call<Array<Product>>

If I call searchProducts("lala"), the query will look like: prod/search?q=lala, but I need it to look like prod/search?q=(?i)\\Qlala\\E

Is there a simple way to format the query parameter to do that?



from format @Query parameter - Retrofit 2

No comments:

Post a Comment