*/
public class BindHashesToHeaders implements Binder {
private HttpRequest addChecksumHeaders(HttpRequest request, Payload payload) {
try {
TreeHash hash = TreeHash.buildTreeHashFromPayload(payload);
request = request.toBuilder()
.addHeader(GlacierHeaders.LINEAR_HASH, hash.getLinearHash().toString())
.addHeader(GlacierHeaders.TREE_HASH, hash.getTreeHash().toString())
.build();
} catch (IOException e) {
throw new HttpException("Error hashing the payload", e);
}
return request;