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

com.undefinedlabs.scope.rules.headers.AkkaHttpHeadersAdapter Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 0.15.1-beta.2
Show newest version
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