All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.smartystreets.api.CustomHeaderSender Maven / Gradle / Ivy

There is a newer version: 3.18.3
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy