在使用retrofit和rxjava2进行网络请求:

//查询订单支付状态
@Headers({
"Content-Type:application/x-www-form-urlencoded",
"appId:android"
})
@GET("/tmi/trade/tradeStatus")
Observable<BaseResponseBody<String>> getStatus(@Query("orderId") String orderId, @Query("date")long date);

然后就报了如下的错误:

java.lang.IllegalStateException:Excepted a String but was BEGIN_OBJECT at line 1 column 43 path $.retEntity

期待返回值是String,但是服务器返回的是json字符串,把String改成相应的类名OK,如:

//查询订单支付状态
@Headers({
"Content-Type:application/x-www-form-urlencoded",
"appId:android"
})
@GET("/tmi/trade/tradeStatus")
Observable<BaseResponseBody<StatusBean>> getStatus(@Query("orderId") String orderId, @Query("date")long date);

谢谢阅读。