org.zalando.logbook.openfeign.HeaderUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logbook-openfeign Show documentation
Show all versions of logbook-openfeign Show documentation
OpenFeign implementations for request and response logging
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);
}
}