改造2 @headers错误在Kotlin [英] retrofit 2 @headers error in kotlin
本文介绍了改造2 @headers错误在Kotlin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用这样的改造2(2.3.0)添加多个静态标头:
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>;
}
我有以下错误:
对我的错误有任何想法吗?
Any idea of my mistake?
推荐答案
在@Headers
中不需要括号{}
.
文档: https://kotlinlang.org/docs/reference/annotations.html#arrays-as-annotation-parameters
这篇关于改造2 @headers错误在Kotlin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文