Add Header Parameter in Retrofit

前端 未结 5 1029
抹茶落季
抹茶落季 2020-12-28 12:44

I\'m trying to call an API which requires me to pass in an API key.

My Service call using HttpURLConnection is working perfectly.

url = new URL(\"htt         


        
5条回答
  •  既然无缘
    2020-12-28 13:19

    As far as i can see you are passing the data in a wrong way. Your method getRestaurantsBySearch is accepting the last two parameter as header field i.e accept and user-key. But while calling the method you are passing headers first. Pass the data as you have declared it in method signature of getRestaurantsBySearch

提交回复
热议问题