I try to add multiple static headers with retrofit 2 (2.3.0) like this :
interface WeatherAPI {
@Headers({
"Accept: application/json",
"Content-type:application/json"
})
@GET("/data/2.5/weather")
fun getWeatherForCityName(@Query("q") city: String, @Query("appid") appid: String) : Call<GetWeatherResponse>;
}
I have the folowing error :
Any idea of my mistake?
Use below code:
@Headers(
"Accept: application/json",
"Content-type:application/json"
)
Braces {}
isn't needed inside @Headers
.
Docs: https://kotlinlang.org/docs/reference/annotations.html#arrays-as-annotation-parameters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With