Tabnine Logo
LiveHttpRequest$Transformer.header
Code IndexAdd Tabnine to your IDE (free)

How to use
header
method
in
com.hotels.styx.api.LiveHttpRequest$Transformer

Best Java code snippets using com.hotels.styx.api.LiveHttpRequest$Transformer.header (Showing top 7 results out of 315)

origin: HotelsDotCom/styx

@Test
public void canModifyPreviouslyCreatedRequest() {
  LiveHttpRequest request = get("/foo")
      .header("remove", "remove")
      .build();
  LiveHttpRequest newRequest = request.newBuilder()
      .uri("/home")
      .header("remove", "notanymore")
      .build();
  assertThat(newRequest.url().path(), is("/home"));
  assertThat(newRequest.headers(), hasItem(header("remove", "notanymore")));
}
origin: HotelsDotCom/styx

@Test
public void transformsHeader() {
  LiveHttpRequest request = LiveHttpRequest.get("/").header("X-Styx-ID", "test").build()
      .newBuilder()
      .header("X-Styx-ID", "bar")
      .build();
  assertEquals(request.header("X-Styx-ID"), Optional.of("bar"));
}
origin: HotelsDotCom/styx

private LiveHttpRequest enrich(LiveHttpRequest request, Context context) {
  LiveHttpRequest.Transformer builder = request.newBuilder();
  xForwardedFor(request, context)
      .ifPresent(headerValue -> builder.header(X_FORWARDED_FOR, headerValue));
  return builder
      .header(requestIdHeaderName, request.id())
      .header(X_FORWARDED_PROTO, xForwardedProto(request, context.isSecure()))
      .build();
}
origin: HotelsDotCom/styx

@Override
public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
  String header = xHcomPluginsHeader(request);
  final String configPath = environment.pluginConfig(String.class);
  String pluginsList = environment.configuration().get("plugins.active").get();
  LiveHttpRequest newRequest = request.newBuilder()
      .header(X_HCOM_PLUGINS_HEADER, header)
      .header(X_HCOM_PLUGINS_CONFIGURATION_PATH, configPath)
      .header(X_HCOM_PLUGINS_LIST, pluginsList)
      .header("X-Hcom-Styx-Started", styxStarted)
      .header("X-Hcom-Styx-Stopped", styxStopped)
      .build();
  Function<ByteBuf, String> byteBufStringFunction = byteBuf -> byteBuf.toString(Charsets.UTF_8);
  return chain.proceed(newRequest)
      .flatMap(response -> response.aggregate(1 * 1024 * 1024))
      .map(response ->
          response.newBuilder()
              .header(X_HCOM_PLUGINS_HEADER, header)
              .header(X_HCOM_PLUGINS_CONFIGURATION_PATH, configPath)
              .header(X_HCOM_PLUGINS_LIST, pluginsList)
              .header("X-Hcom-Styx-Started", styxStarted)
              .header("X-Hcom-Styx-Stopped", styxStopped)
              .build())
      .map(HttpResponse::stream);
}
origin: HotelsDotCom/styx

  @Override
  public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
    return request.aggregate(config.maxContentLength())
            .flatMap(fullHttpRequest -> Eventual.from(asyncOperation(config.delayMillis())))
            .map(outcome -> request.newBuilder().header("X-Outcome", outcome.result()))
            .flatMap(x -> chain.proceed(request));
  }
}
origin: HotelsDotCom/styx

@Override
public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
  LiveHttpRequest newRequest = request.newBuilder()
      .header(VIA, viaHeader(request))
      .build();
  return chain.proceed(newRequest)
      .map(response -> response.newBuilder()
          .header(VIA, viaHeader(response))
          .build());
}
origin: HotelsDotCom/styx

private static LiveHttpRequest addUserAgent(String userAgent, LiveHttpRequest request) {
  if (userAgent != null) {
    return request.newBuilder()
        .header(USER_AGENT, userAgent)
        .build();
  } else {
    return request;
  }
}
com.hotels.styx.apiLiveHttpRequest$Transformerheader

Popular methods of LiveHttpRequest$Transformer

  • build
  • removeHeader
  • url
  • <init>
  • addCookies
  • addHeader
  • body
    Transforms request body.
  • cookies
  • headers
  • id
  • removeCookies
  • uri
  • removeCookies,
  • uri,
  • version

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now