Fast-android-networking: cant get Headers

Created on 15 Sep 2016  路  10Comments  路  Source: amitshekhariitbhu/Fast-Android-Networking

Headers s=AndroidNetworking.get("http://www.frendz4m.com/forum/login.php")
.build().getHeaders() ;
textView.setText(s.toMultimap().values().size()+"");

final ANRequest s=AndroidNetworking.post("http://www.frendz4m.com/forum/authenticate.php")
.addHeaders("Cookie",cookieToString(cookies))
.build() ;
String str=s.getHeaders().get("Set-Cookie")+"";

addHeaders() method working fine.

but getHeaders() return null value

I want to save cookies. but i am unable to get "Set-Cookie:" header

question

All 10 comments

@hiteshrawat : Using getHeaders, do you want to get Headers returned from server?

Yes, I want to store cookies returned by server

In version 0.1.0 there is no way to access headers from server. I have added it in 0.2.0. which I am testing now. and going to release by tomorrow, For now you can use that version

'com.amitshekhar.android:android-networking:0.2.0-dev-0'

The sample code is :

AndroidNetworking.get(url)
                            .build()
                            .getAsOkHttpResponse(new OkHttpResponseListener() {
                                @Override
                                public void onResponse(Response response) {
                                    Log.d(TAG, "Headers :" + response.headers());
                                }

                                @Override
                                public void onError(ANError anError) {
                                    //handle error
                                }
                            });

thank you Amit. Please add download link for .jar library files also

I wanted to know why don't u use gradle or is there any benefit of using jar. (eclipse it is useful other wise)?

Mostly I use college wifi. I dont have network connection at home. So I use jar files[like jsoup.jar] and test apps on mobile's 3g connection.

Oh nice .

I have uploaded the version 0.2.0 here ignore dev version and use this

com.amitshekhar.android:android-networking:0.2.0

Will upload the jar file by tomorrow.

Thanks Amit. Keep it up. Your AndroidNetworking library is very useful for beginners.

Thanks for comfortable lib. where is uploaded jar file ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

igabice picture igabice  路  8Comments

salmansynergytop picture salmansynergytop  路  6Comments

ExploiTR picture ExploiTR  路  7Comments

MohadFarhan picture MohadFarhan  路  5Comments

MxNINJA picture MxNINJA  路  3Comments