Tabnine Logo
HttpHeaders$Builder.add
Code IndexAdd Tabnine to your IDE (free)

How to use
add
method
in
com.hotels.styx.api.HttpHeaders$Builder

Best Java code snippets using com.hotels.styx.api.HttpHeaders$Builder.add (Showing top 20 results out of 315)

origin: HotelsDotCom/styx

@Test
public void removesNullValues() {
  HttpHeaders headers = new Builder()
      .add("header1", asList("val1", null, "val2"))
      .build();
  assertThat(headers, contains(header("header1", "val1"), header("header1", "val2")));
}
origin: HotelsDotCom/styx

@BeforeMethod
public void setUp() {
  headers = new HttpHeaders.Builder()
      .add("header1", "val1")
      .add("header2", asList("val2a", "val2b"))
      .build();
}
origin: HotelsDotCom/styx

private static HttpHeaders toStyxHeaders(com.github.tomakehurst.wiremock.http.HttpHeaders headers) {
  HttpHeaders.Builder builder = new HttpHeaders.Builder();
  if (headers != null) {
    headers.all().forEach(header -> builder.add(header.key(), header.values()));
  }
  return builder.build();
}
origin: HotelsDotCom/styx

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  headers.add(name, value);
  return this;
}
origin: HotelsDotCom/styx

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  headers.add(name, value);
  return this;
}
origin: HotelsDotCom/styx

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  the name of the header
 * @param value the value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  this.headers.add(name, value);
  return this;
}
origin: com.hotels.styx/styx-api

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  headers.add(name, value);
  return this;
}
origin: com.hotels.styx/styx-api

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  checkNotCookie(name);
  this.headers.add(name, value);
  return this;
}
origin: com.hotels.styx/styx-api

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  checkNotCookie(name);
  this.headers.add(name, value);
  return this;
}
origin: com.hotels.styx/styx-api

/**
 * Adds a new header with the specified {@code name} and {@code value}.
 * <p/>
 * Will not replace any existing values for the header.
 *
 * @param name  The name of the header
 * @param value The value of the header
 * @return {@code this}
 */
public Builder addHeader(CharSequence name, Object value) {
  headers.add(name, value);
  return this;
}
origin: HotelsDotCom/styx

@Test(expectedExceptions = NullPointerException.class)
public void doesNotAllowNullName() {
  new HttpHeaders.Builder()
      .add(null, "value")
      .build();
}
origin: HotelsDotCom/styx

@Test(expectedExceptions = NullPointerException.class)
public void doesNotAllowNullValue() {
  new HttpHeaders.Builder()
      .add("header1", (String) null)
      .build();
}
origin: com.hotels.styx/styx-api

/**
 * Set the response to be chunked.
 *
 * @return {@code this}
 */
public SELF chunked() {
  headers().add(TRANSFER_ENCODING, CHUNKED);
  headers().remove(CONTENT_LENGTH);
  return (SELF) this;
}
origin: com.hotels.styx/styx-api

/**
 * Makes this response chunked.
 *
 * @return {@code this}
 */
public Builder setChunked() {
  headers.add(TRANSFER_ENCODING, CHUNKED);
  headers.remove(CONTENT_LENGTH);
  return this;
}
origin: HotelsDotCom/styx

@Test
public void setsHeaders() {
  HttpHeaders newHeaders = new HttpHeaders.Builder()
      .add("foo", "bar")
      .build();
  HttpHeaders headers = new HttpHeaders.Builder(newHeaders)
      .build();
  assertThat(headers, contains(header("foo", "bar")));
}
origin: HotelsDotCom/styx

@Test
public void transformerSetsHeaders() {
  LiveHttpResponse response = response().build()
      .newBuilder()
      .headers(new HttpHeaders.Builder().add("X-Styx-ID", "z").build())
      .build();
  assertEquals(response.header("X-Styx-ID"), Optional.of("z"));
}
origin: com.hotels.styx/styx-api

/**
 * Enables Keep-Alive.
 *
 * @return {@code this}
 */
public Builder enableKeepAlive() {
  this.headers().add(CONNECTION, KEEP_ALIVE);
  return this;
}
origin: HotelsDotCom/styx

/**
 * Makes this response chunked.
 *
 * @return {@code this}
 */
public Builder setChunked() {
  headers.add(TRANSFER_ENCODING, CHUNKED);
  headers.remove(CONTENT_LENGTH);
  return this;
}
origin: HotelsDotCom/styx

/**
 * Makes this response chunked.
 *
 * @return {@code this}
 */
public Builder setChunked() {
  headers.add(TRANSFER_ENCODING, CHUNKED);
  headers.remove(CONTENT_LENGTH);
  return this;
}
origin: com.hotels.styx/styx-api

/**
 * Makes this response chunked.
 *
 * @return {@code this}
 */
public Builder setChunked() {
  headers.add(TRANSFER_ENCODING, CHUNKED);
  headers.remove(CONTENT_LENGTH);
  return this;
}
com.hotels.styx.apiHttpHeaders$Builderadd

Javadoc

Adds a new header with the specified name and values.

Will not replace any existing values for the header.

Popular methods of HttpHeaders$Builder

  • <init>
  • build
  • set
    Sets the (only) value for the header with the specified name. All existing values for the same heade
  • get
  • getAll
  • nonNullValues
  • remove
    Removes the header with the specified name.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Kernel (java.awt.image)
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JCheckBox (javax.swing)
  • JOptionPane (javax.swing)
  • Option (scala)
  • CodeWhisperer alternatives
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