package io.wealthwizards.appsynctesting.utils;

import java.util.Map;
import java.util.List;
import java.util.stream.Collectors;

public final class Http {
    public Map<String, String> copyHeaders(Map<String, String> headers) {
        var excluded = List.of(
                "content-type",
                "user-agent",
                "expectation",
                "transfer-encoding",
                "content-length"
        );

        return headers.entrySet()
                .stream()
                .map(entry -> Map.entry(
                        entry.getKey().toLowerCase(),
                        entry.getValue()
                ))
                .filter(entry -> !excluded.contains(entry.getKey()))
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> b));
    }
}
