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

org.zalando.logbook.openfeign.HeaderUtils Maven / Gradle / Ivy

The newest version!
package org.zalando.logbook.openfeign;

import org.zalando.logbook.HttpHeaders;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

class HeaderUtils {
    private HeaderUtils() {
    }

    /**
     * Convert Feign headers to Logbook-compatible format
     *
     * @param feignHeaders original headers
     * @return Logbook headers
     */
    static HttpHeaders toLogbookHeaders(Map> feignHeaders) {
        Map> convertedHeaders = new HashMap<>();
        for (Map.Entry> header : feignHeaders.entrySet()) {
            convertedHeaders.put(header.getKey(), new ArrayList<>(header.getValue()));
        }
        return HttpHeaders.of(convertedHeaders);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy