在改造中遇到一些不同的错误

时间:2018-06-20 11:48:51

标签: android retrofit2

我正在使用 retrofit 2 进行发布请求,但得到了回复:

W / Retrofit @ Response:

  

Ʊ        �0�W9n�RĹ��C5P}�4�mm�.T�]��sǣk�����{�R''�&�''j9Z*�f�ؘ��T ��!wʔ6��> A \Gǚ�JGP��H[�[�|��

我从以下位置打印此回复:

    httpClient = new OkHttpClient.Builder()
            .addInterceptor(
                    new Interceptor() {
                        @Override
                        public Response intercept(Interceptor.Chain chain) throws IOException {
                            Request original = chain.request();

                            // Request customization: add request headers
                            Request.Builder requestBuilder = original.newBuilder()
                                    .header("Authorization", token)
                                    .header("Content-Type", "application/json")
                                    .header("Accept", "application/json")
                                    .method(original.method(), original.body());
                            Response response = chain.proceed(chain.request());
                            Log.w("Retrofit@Response", response.body().string());

                            Request request = requestBuilder.build();
                            return chain.proceed(request);
                        }
                    })
            .addInterceptor(logging)

            .build();

标题和api:

 @Headers({
        "Content-Type: application/json",
        "Authorization: Bearer znvct0zvHcfCtVttJQs__6C_okZ7tBSsXoyoRaMrXHoxczjBLdq5smYZToHM1KXd8EzIL1UkHwg8JsuqMHUgLKkWy-dk_51fyIfSXEWXS2h1EBINqvYpALqSi5p47_nm4Jlb6wBlKq_hS99oWUvlJW1tKOwtVC4dG0rrh7_M2CT74YsXAx-8tLQcnMBaWF1TRkgLYdaQ0wjcx4SV1lNaWdmRcZfR5HbszprFMxbe_MXK1tmd-JWfNCbWfasB-p1zecoWzfaKoNh7GjrdkF9Ek3Pu2CzWxr75Y6bC3xwgRf1zsHPJ3J_IuA5wQZVbxIz38oc23gT1bqojMP7krs-9Z5xazjAV1Qcwjj85jN2cHPFEr2NG6pGqX5_0cP7vK8RDKJAlyVyCcvclrSjFo5rkrpNsp3R1x2N_4u36ODYrm-6FNJ9P85mwIc7yvn_RSa-ggDVfmNFhhxOJIhu3B5StBT42P_xMBiw2J6yeGdJVJgqygJfrqQkgRU5IzS-u-8x6b7C48_h6703ijkmTtR77yXhwH1IDEi2BsW1egDdPsuH3LRlO9uLeBEsiRVC7jvSkuqcv7xxoEYNpRxhmPr7Eyp4Eqb0qYRcRmuFEBISG8Aj7wIf0pr2V-stpRV4BKaUhHqT7qtyDsbpmJUimuPvrmM93T22PRD3hqe8bgMYjgvVZB3BiCTlmv1pJs4qrqxNnnaVg0HpkNGC9gWKvkryCA",
})
@POST("/AppIntegraion/api/InsertSignUp")
Call<String> getUser(@Body abd params);

仅当为其他api添加授权标头时,才会发生此问题。

此api在邮递员上工作正常。因此,这不是服务器问题。请帮助我。

0 个答案:

没有答案