org.mockserver.model.Header Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockserver-core Show documentation
Show all versions of mockserver-core Show documentation
Functionality used by all MockServer modules for matching and expectations
package org.mockserver.model;
import java.util.Arrays;
import java.util.Collection;
import static org.mockserver.model.NottableOptionalString.optional;
import static org.mockserver.model.NottableString.string;
/**
* @author jamesdbloom
*/
public class Header extends KeyToMultiValue {
public Header(String name, String... value) {
super(name, value);
}
public Header(NottableString name, NottableString... value) {
super(name, value);
}
public Header(NottableString name, String... value) {
super(name, value);
}
public Header(String name, Collection value) {
super(name, value);
}
public Header(NottableString name, Collection value) {
super(name, value);
}
public static Header header(String name, int value) {
return new Header(name, String.valueOf(value));
}
public static Header header(String name, String... value) {
return new Header(name, value);
}
public static Header header(NottableString name, NottableString... value) {
return new Header(name, value);
}
public static Header header(String name, Collection value) {
return new Header(name, value);
}
public static Header header(NottableString name, Collection value) {
return new Header(name, value);
}
public static Header schemaHeader(String name, String... values) {
if (values.length == 0) {
values = new String[]{".*"};
}
return new Header(string(name), Arrays.stream(values).map(NottableSchemaString::schemaString).toArray(NottableString[]::new));
}
public static Header optionalHeader(String name, String... values) {
if (values.length == 0) {
values = new String[]{".*"};
}
return new Header(optional(name), Arrays.stream(values).map(NottableString::string).toArray(NottableString[]::new));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy