0

I am using this library for service requests and I was wondering if I could add unknown number of key-value headers in a loop like from a hashmap using this library and I could not find any way to do that.

Can set bodyParemeters through Map collection but not for headers. Anyone knows if it is possible let me know please.

Atif Rehman
  • 325
  • 1
  • 12

1 Answers1

0

I am amazed by seeing that no one responded to this simple problem I figured out on my own.

 ArrayList<BasicNameValuePair> headers;

and then we can loop Builder.Any.B

    Builders.Any.B b = Ion.with(mContext)
            .load(request_url);
    for (int i = 0; i < headers.size(); i++) {
        BasicNameValuePair pair = headers.get(i);
        b.addHeader(pair.getName(), pair.getValue());
    }
Atif Rehman
  • 325
  • 1
  • 12