Fast-android-networking: Head request

Created on 23 Jul 2016  路  3Comments  路  Source: amitshekhariitbhu/Fast-Android-Networking

I need example HEAD request. I tried this

AndroidNetworking.head (BASE_URL)
.addQueryParameter ("username", username)
.addQueryParameter ("password", password)
.setPriority (Priority.MEDIUM)
.build ()
.getAsString (stringRequestListener);

But the response is an empty string.

bug

All 3 comments

@amervelic : HEAD request is useful for retrieving meta-information written in response headers, without having to transport the entire content. So the response is empty. Any there is a bug that I will fix to expose the headers as a response in upcoming release. As of you can not get the headers as it is not exposed.

@amervelic : fixed in development branch

In version 0.1.0 there is no way to access headers from server. I have added it in version 0.2.0.
Version 0.2.0 has been released
'com.amitshekhar.android:android-networking:0.2.0'

The sample code is :

                 AndroidNetworking.head(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
                                }
                            });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ExploiTR picture ExploiTR  路  7Comments

salmansynergytop picture salmansynergytop  路  6Comments

rezasadeghi93 picture rezasadeghi93  路  8Comments

MahdiPishguy picture MahdiPishguy  路  5Comments

SunryTeang picture SunryTeang  路  4Comments