com.undefinedlabs.scope.rules.headers.AkkaHttpHeadersAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scope-rule-akka-http Show documentation
Show all versions of scope-rule-akka-http Show documentation
Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly
identify, troubleshoot and fix failed builds.
This artifact contains the classes to instrument the Akka HTTP.
package com.undefinedlabs.scope.rules.headers;
import akka.http.javadsl.model.HttpHeader;
import com.undefinedlabs.scope.rules.http.HttpHeadersAdapter;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class AkkaHttpHeadersAdapter implements HttpHeadersAdapter {
private final Iterable headers;
public AkkaHttpHeadersAdapter(final Iterable headers) {
this.headers = headers;
}
@Override
public Iterable> iterator() {
if (headers == null) {
return Collections.unmodifiableMap(new HashMap()).entrySet();
}
final Map headersMap = new HashMap<>();
for (final HttpHeader header : this.headers) {
headersMap.put(header.name(), header.value());
}
return Collections.unmodifiableMap(headersMap).entrySet();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy