com.smartystreets.api.CustomHeaderSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smartystreets-java-sdk Show documentation
Show all versions of smartystreets-java-sdk Show documentation
A library to help Java developers easily access the SmartyStreets APIs.
package com.smartystreets.api;
import com.smartystreets.api.exceptions.SmartyException;
import java.io.IOException;
import java.util.Map;
public class CustomHeaderSender implements Sender {
private Map headers;
private Sender inner;
public CustomHeaderSender(Map headers, Sender inner){
this.headers = headers;
this.inner = inner;
}
@Override
public Response send(Request request) throws SmartyException, IOException {
for (Map.Entry entry : this.headers.entrySet()) {
request.putHeader((String)entry.getKey(), entry.getValue());
}
return this.inner.send(request);
}
}