预期为 BEGIN_OBJECT 但在线为 STRING - GSON

Expected BEGIN_OBJECT but was STRING at line - GSON

我正在从 api:

收到 url
{"status":true,"ref":"urltogo","url":"http:\/\/myurl\/login\/index.php?testsession=55207"}

这是我的连接api

mCompositeCommonDisposable.add(
            login.getResultLogin("YYYY", "YYYY","/")
                !!.observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribeWith(object : DisposableObserver<Response<Login?>>() {
                    override fun onNext(loginResponse: Response<Login?>) {
                        if (loginResponse.isSuccessful) {
                            if (loginResponse.body() != null) {
                                loginModelApiResponseResultListener.onSuccess(
                                    loginResponse.body()
                                )
                            } else {
                                loginModelApiResponseResultListener.onFailure(R.string.err_information)
                            }
                        } else {
                            loginModelApiResponseResultListener.onFailure(R.string.err_information)
                        }
                    }

                    override fun onError(e: Throwable) {
                        loginModelApiResponseResultListener.onFailure(R.string.fetching_data_failed)
                    }

                    override fun onComplete() {}
                })

这是我的 interface:

interface PublicApiTS {
    @POST("/theme/fordson2/login")
    fun getResultLogin(
        @Query("username") username: String?,
        @Query("password") password: String?,
        @Query("returnurl") returnurl: String?
    ): Observable<Response<Login?>?>?
}

但它说我:

java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $    c

这是我的习惯 object:

@Entity(tableName = "Login")
data class Login (
    @PrimaryKey(autoGenerate = true)
    var id_login: Int = 0,
    @SerializedName("status")
    @Expose
    val status: Boolean? = null,
    @SerializedName("ref")
    @Expose
    val ref: String? = null,
    @SerializedName("url")
    @Expose
    val url: String? = null
)

这是我的改装模块:

@Module
class RemoteAPIDataModuleTS {
    @Provides
    fun provideGson(): Gson {
        return GsonBuilder().setLenient().create()
    }

    @Provides
    fun providePublicApi(retrofit: Retrofit): PublicApiTS {
        return retrofit.create(PublicApiTS::class.java)
    }

    @Provides
    fun provideRetrofitCommon(gson: Gson?): Retrofit {
        val client = OkHttpClient.Builder()
            .connectTimeout(60, TimeUnit.SECONDS)
            .readTimeout(60, TimeUnit.SECONDS)
            .writeTimeout(60, TimeUnit.SECONDS)
            .build()
        return Retrofit.Builder()
            .client(client)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create(gson!!))
            .addConverterFactory(ScalarsConverterFactory.create())
            .baseUrl(API_LOGIN_URL)
            .build()
    }
}

我编辑我的 interface 以喜欢以下内容和出色的工作:

interface PublicApiTS {
    @POST("/theme/fordson2/login")
    @FormUrlEncoded
    fun getResultLogin(
        @Field("username") username: String?,
        @Field("password") password: String?,
        @Field("returnurl") returnurl: String?
    ): Observable<Response<Login?>?>?
}

这里:@Query ---> 到 ---> @Field