Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Head request #9

Closed
amervelic opened this issue Jul 23, 2016 · 3 comments
Closed

Head request #9

amervelic opened this issue Jul 23, 2016 · 3 comments
Assignees
Labels

Comments

@amervelic
Copy link

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.

@amitshekhariitbhu
Copy link
Owner

@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.

@amitshekhariitbhu amitshekhariitbhu self-assigned this Jul 23, 2016
@amitshekhariitbhu amitshekhariitbhu added this to the 0.1.0 milestone Jul 23, 2016
@amitshekhariitbhu amitshekhariitbhu removed this from the 0.1.0 milestone Jul 30, 2016
@amitshekhariitbhu
Copy link
Owner

@amervelic : fixed in development branch

@amitshekhariitbhu
Copy link
Owner

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
                                }
                            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants