Forcing kotlin to be in 1.3.31
This commit is contained in:
@@ -10,6 +10,11 @@ indent_style = tab
|
||||
indent_size = 4
|
||||
continuation_indent_size = 8
|
||||
|
||||
[*.kt]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
continuation_indent_size = 8
|
||||
|
||||
[*.xml]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
3
pom.xml
3
pom.xml
@@ -63,7 +63,8 @@
|
||||
<jacoco-maven-plugin.version>0.8.4</jacoco-maven-plugin.version>
|
||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||
<InMemoryJavaCompiler.version>1.3.0</InMemoryJavaCompiler.version>
|
||||
<kotlin.version>1.3.50</kotlin.version>
|
||||
<!-- Aligned with Gradle, otherwise Gradle based projects won't work well -->
|
||||
<contract.kotlin.version>1.3.31</contract.kotlin.version>
|
||||
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -21,22 +21,22 @@
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler-embeddable</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-scripting-compiler-embeddable</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-util</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -46,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -57,7 +57,7 @@
|
||||
<plugin>
|
||||
<!-- Based on instructions here - https://kotlinlang.org/docs/reference/using-maven.html -->
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<configuration>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
|
||||
@@ -16,15 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.contract.spec
|
||||
|
||||
import org.springframework.cloud.contract.spec.internal.ContractDslMarker
|
||||
import org.springframework.cloud.contract.spec.internal.Input
|
||||
import org.springframework.cloud.contract.spec.internal.InputDsl
|
||||
import org.springframework.cloud.contract.spec.internal.OutputMessage
|
||||
import org.springframework.cloud.contract.spec.internal.OutputMessageDsl
|
||||
import org.springframework.cloud.contract.spec.internal.Request
|
||||
import org.springframework.cloud.contract.spec.internal.RequestDsl
|
||||
import org.springframework.cloud.contract.spec.internal.Response
|
||||
import org.springframework.cloud.contract.spec.internal.ResponseDsl
|
||||
import org.springframework.cloud.contract.spec.internal.*
|
||||
|
||||
/**
|
||||
* @author Tim Ysewyn
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.springframework.cloud.contract.spec.internal.DslProperty
|
||||
import org.springframework.cloud.contract.spec.internal.QueryParameters
|
||||
import org.springframework.cloud.contract.spec.internal.Url
|
||||
import org.springframework.cloud.contract.spec.internal.UrlPath
|
||||
import java.lang.IllegalStateException
|
||||
import java.util.stream.Collectors
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ infix fun UrlPath.withQueryParameters(parameters: QueryParameters.() -> Unit) =
|
||||
queryParameters = QueryParameters().apply(parameters)
|
||||
}
|
||||
|
||||
fun <T: Any> T.toDslProperty(): DslProperty<T> = DslProperty(this)
|
||||
fun <T : Any> T.toDslProperty(): DslProperty<T> = DslProperty(this)
|
||||
|
||||
fun Map<String, Any>.toDslProperties(): Map<String, DslProperty<Any>> {
|
||||
return entries.stream().collect(Collectors.toMap(
|
||||
|
||||
@@ -26,59 +26,59 @@ import java.util.regex.Pattern
|
||||
*/
|
||||
open class BodyMatchersDsl {
|
||||
|
||||
private val jsonPathMatchers = LinkedHashMap<String, MatchingTypeValue>()
|
||||
private val xPathMatchers = LinkedHashMap<String, MatchingTypeValue>()
|
||||
private val jsonPathMatchers = LinkedHashMap<String, MatchingTypeValue>()
|
||||
private val xPathMatchers = LinkedHashMap<String, MatchingTypeValue>()
|
||||
|
||||
/**
|
||||
* Adds a JSON path matcher.
|
||||
*
|
||||
* @param path The path.
|
||||
* @param matcher The matcher.
|
||||
*/
|
||||
fun jsonPath(path: String, matcher: MatchingTypeValue) {
|
||||
this.jsonPathMatchers[path] = matcher
|
||||
}
|
||||
/**
|
||||
* Adds a JSON path matcher.
|
||||
*
|
||||
* @param path The path.
|
||||
* @param matcher The matcher.
|
||||
*/
|
||||
fun jsonPath(path: String, matcher: MatchingTypeValue) {
|
||||
this.jsonPathMatchers[path] = matcher
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an xPath matcher.
|
||||
*
|
||||
* @param path The path.
|
||||
* @param matcher The matcher.
|
||||
*/
|
||||
fun xPath(path: String, matcher: MatchingTypeValue) {
|
||||
this.xPathMatchers[path] = matcher
|
||||
}
|
||||
/**
|
||||
* Adds an xPath matcher.
|
||||
*
|
||||
* @param path The path.
|
||||
* @param matcher The matcher.
|
||||
*/
|
||||
fun xPath(path: String, matcher: MatchingTypeValue) {
|
||||
this.xPathMatchers[path] = matcher
|
||||
}
|
||||
|
||||
/* HELPER VARIABLES */
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
val byDate
|
||||
get() = MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate())
|
||||
val byDate
|
||||
get() = MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate())
|
||||
|
||||
val byTime
|
||||
get() = MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime())
|
||||
val byTime
|
||||
get() = MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime())
|
||||
|
||||
val byTimestamp
|
||||
get() = MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime())
|
||||
val byTimestamp
|
||||
get() = MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime())
|
||||
|
||||
val byEquality
|
||||
get() = MatchingTypeValue(MatchingType.EQUALITY)
|
||||
val byEquality
|
||||
get() = MatchingTypeValue(MatchingType.EQUALITY)
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
fun byRegex(regex: String) = byRegex(Pattern.compile(regex))
|
||||
fun byRegex(regex: String) = byRegex(Pattern.compile(regex))
|
||||
|
||||
fun byRegex(regex: RegexProperty) = RegexMatchingTypeValue(MatchingType.REGEX, regex)
|
||||
fun byRegex(regex: RegexProperty) = RegexMatchingTypeValue(MatchingType.REGEX, regex)
|
||||
|
||||
fun byRegex(regex: Pattern) = RegexMatchingTypeValue(MatchingType.REGEX, RegexProperty(regex))
|
||||
fun byRegex(regex: Pattern) = RegexMatchingTypeValue(MatchingType.REGEX, RegexProperty(regex))
|
||||
|
||||
fun byType(configurer: MatchingTypeValueHolder.() -> Unit): MatchingTypeValue = MatchingTypeValueHolder().apply(configurer).matchingTypeValue
|
||||
fun byType(configurer: MatchingTypeValueHolder.() -> Unit): MatchingTypeValue = MatchingTypeValueHolder().apply(configurer).matchingTypeValue
|
||||
|
||||
internal open fun get(): BodyMatchers = configureBodyMatchers(BodyMatchers())
|
||||
internal open fun get(): BodyMatchers = configureBodyMatchers(BodyMatchers())
|
||||
|
||||
internal fun <T: BodyMatchers> configureBodyMatchers(bodyMatchers: T): T {
|
||||
this.jsonPathMatchers.forEach(bodyMatchers::jsonPath)
|
||||
this.xPathMatchers.forEach(bodyMatchers::xPath)
|
||||
return bodyMatchers
|
||||
}
|
||||
internal fun <T : BodyMatchers> configureBodyMatchers(bodyMatchers: T): T {
|
||||
this.jsonPathMatchers.forEach(bodyMatchers::jsonPath)
|
||||
this.xPathMatchers.forEach(bodyMatchers::xPath)
|
||||
return bodyMatchers
|
||||
}
|
||||
|
||||
}
|
||||
@@ -91,7 +91,7 @@ open class CommonDsl {
|
||||
get() = RegexPatterns.nonBlank()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the consumer side.
|
||||
* @param clientValue client value
|
||||
@@ -228,7 +228,7 @@ open class CommonDsl {
|
||||
contentType: DslProperty<Any>) = NamedProperty(name, value, contentType)
|
||||
|
||||
fun named(namedMap: Map<String, DslProperty<Any>>) = NamedProperty(namedMap)
|
||||
|
||||
|
||||
/* REGEX FUNCTIONS */
|
||||
|
||||
fun regexProperty(value: Any) = RegexProperty(value)
|
||||
|
||||
@@ -23,7 +23,7 @@ package org.springframework.cloud.contract.spec.internal
|
||||
* @since 2.2.0
|
||||
*/
|
||||
open class CookiesDsl : CommonDsl() {
|
||||
|
||||
|
||||
private val cookies = LinkedHashMap<String, Any>()
|
||||
|
||||
open fun matching(value: Any?): Any? = value
|
||||
|
||||
@@ -26,151 +26,151 @@ import org.springframework.cloud.contract.spec.ContractTemplate
|
||||
*/
|
||||
class FromRequestDsl {
|
||||
|
||||
private val template: ContractTemplate = HandlebarsContractTemplate()
|
||||
private val template: ContractTemplate = HandlebarsContractTemplate()
|
||||
|
||||
/**
|
||||
* @return URL path and query.
|
||||
*/
|
||||
fun url() = FromRequestDslProperty(template.escapedUrl())
|
||||
/**
|
||||
* @return URL path and query.
|
||||
*/
|
||||
fun url() = FromRequestDslProperty(template.escapedUrl())
|
||||
|
||||
/**
|
||||
* First value of a query parameter e.g. request.query.search.
|
||||
* @param key key for the query param
|
||||
* @return dsl property
|
||||
*/
|
||||
fun query(key: String) = FromRequestDslProperty(template.escapedQuery(key))
|
||||
/**
|
||||
* First value of a query parameter e.g. request.query.search.
|
||||
* @param key key for the query param
|
||||
* @return dsl property
|
||||
*/
|
||||
fun query(key: String) = FromRequestDslProperty(template.escapedQuery(key))
|
||||
|
||||
/**
|
||||
* nth value of a query parameter (zero indexed) e.g. request.query.search.[5].
|
||||
* @param key key for the query param
|
||||
* @param index index of the query param
|
||||
* @return dsl property
|
||||
*/
|
||||
fun query(key: String, index: Int) = FromRequestDslProperty(template.escapedQuery(key, index))
|
||||
/**
|
||||
* nth value of a query parameter (zero indexed) e.g. request.query.search.[5].
|
||||
* @param key key for the query param
|
||||
* @param index index of the query param
|
||||
* @return dsl property
|
||||
*/
|
||||
fun query(key: String, index: Int) = FromRequestDslProperty(template.escapedQuery(key, index))
|
||||
|
||||
/**
|
||||
* URL path.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun path() = FromRequestDslProperty(template.escapedPath())
|
||||
/**
|
||||
* URL path.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun path() = FromRequestDslProperty(template.escapedPath())
|
||||
|
||||
/**
|
||||
* nth value of a URL path (zero indexed) e.g. {{{ request.path.[2] }}}.
|
||||
* @param index path index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun path(index: Int) = FromRequestDslProperty(template.escapedPath(index))
|
||||
/**
|
||||
* nth value of a URL path (zero indexed) e.g. {{{ request.path.[2] }}}.
|
||||
* @param index path index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun path(index: Int) = FromRequestDslProperty(template.escapedPath(index))
|
||||
|
||||
/**
|
||||
* First value of a request header e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun header(key: String) = FromRequestDslProperty(template.escapedHeader(key))
|
||||
/**
|
||||
* First value of a request header e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun header(key: String) = FromRequestDslProperty(template.escapedHeader(key))
|
||||
|
||||
/**
|
||||
* nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @param index header index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun header(key: String, index: Int) = FromRequestDslProperty(template.escapedHeader(key, index))
|
||||
/**
|
||||
* nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @param index header index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun header(key: String, index: Int) = FromRequestDslProperty(template.escapedHeader(key, index))
|
||||
|
||||
/**
|
||||
* Returns the template for retrieving the first value of a cookie with certain key.
|
||||
* @param key cookie key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun cookie(key: String) = FromRequestDslProperty(template.escapedCookie(key))
|
||||
/**
|
||||
* Returns the template for retrieving the first value of a cookie with certain key.
|
||||
* @param key cookie key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun cookie(key: String) = FromRequestDslProperty(template.escapedCookie(key))
|
||||
|
||||
/**
|
||||
* Request body text (avoid for non-text bodies).
|
||||
* @return dsl property
|
||||
*/
|
||||
fun body() = FromRequestDslProperty(template.escapedBody())
|
||||
/**
|
||||
* Request body text (avoid for non-text bodies).
|
||||
* @return dsl property
|
||||
*/
|
||||
fun body() = FromRequestDslProperty(template.escapedBody())
|
||||
|
||||
/**
|
||||
* Request body text for the given JsonPath.
|
||||
* @param jsonPath json path body
|
||||
* @return dsl property
|
||||
*/
|
||||
fun body(jsonPath: String) = FromRequestDslProperty(template.escapedBody(jsonPath))
|
||||
/**
|
||||
* Request body text for the given JsonPath.
|
||||
* @param jsonPath json path body
|
||||
* @return dsl property
|
||||
*/
|
||||
fun body(jsonPath: String) = FromRequestDslProperty(template.escapedBody(jsonPath))
|
||||
|
||||
/**
|
||||
* Unescaped URL path and query.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawUrl() = FromRequestDslProperty(template.url())
|
||||
/**
|
||||
* Unescaped URL path and query.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawUrl() = FromRequestDslProperty(template.url())
|
||||
|
||||
/**
|
||||
* Unescaped first value of a query parameter e.g. request.query.search.
|
||||
* @param key query key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawQuery(key: String) = FromRequestDslProperty(template.query(key))
|
||||
/**
|
||||
* Unescaped first value of a query parameter e.g. request.query.search.
|
||||
* @param key query key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawQuery(key: String) = FromRequestDslProperty(template.query(key))
|
||||
|
||||
/**
|
||||
* Unescaped nth value of a query parameter (zero indexed) e.g.
|
||||
* request.query.search.[5].
|
||||
* @param key query key
|
||||
* @param index query index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawQuery(key: String, index: Int) = FromRequestDslProperty(template.query(key, index))
|
||||
/**
|
||||
* Unescaped nth value of a query parameter (zero indexed) e.g.
|
||||
* request.query.search.[5].
|
||||
* @param key query key
|
||||
* @param index query index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawQuery(key: String, index: Int) = FromRequestDslProperty(template.query(key, index))
|
||||
|
||||
/**
|
||||
* Unescaped URL path.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawPath() = FromRequestDslProperty(template.path())
|
||||
/**
|
||||
* Unescaped URL path.
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawPath() = FromRequestDslProperty(template.path())
|
||||
|
||||
/**
|
||||
* Unescaped nth value of a URL path (zero indexed) e.g. {{{ request.path.[2]. }}}.
|
||||
* @param index path index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawPath(index: Int) = FromRequestDslProperty(template.path(index))
|
||||
/**
|
||||
* Unescaped nth value of a URL path (zero indexed) e.g. {{{ request.path.[2]. }}}.
|
||||
* @param index path index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawPath(index: Int) = FromRequestDslProperty(template.path(index))
|
||||
|
||||
/**
|
||||
* Unescaped first value of a request header e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawHeader(key: String) = FromRequestDslProperty(template.header(key))
|
||||
/**
|
||||
* Unescaped first value of a request header e.g. request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawHeader(key: String) = FromRequestDslProperty(template.header(key))
|
||||
|
||||
/**
|
||||
* Unescaped nth value of a request header (zero indexed) e.g.
|
||||
* request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @param index header index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawHeader(key: String, index: Int) = FromRequestDslProperty(template.header(key, index))
|
||||
/**
|
||||
* Unescaped nth value of a request header (zero indexed) e.g.
|
||||
* request.headers.X-Request-Id.
|
||||
* @param key header key
|
||||
* @param index header index
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawHeader(key: String, index: Int) = FromRequestDslProperty(template.header(key, index))
|
||||
|
||||
/**
|
||||
* Unescaped Returns the template for retrieving the first value of a cookie with
|
||||
* certain key.
|
||||
* @param key cookie key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawCookie(key: String) = FromRequestDslProperty(template.cookie(key))
|
||||
/**
|
||||
* Unescaped Returns the template for retrieving the first value of a cookie with
|
||||
* certain key.
|
||||
* @param key cookie key
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawCookie(key: String) = FromRequestDslProperty(template.cookie(key))
|
||||
|
||||
/**
|
||||
* Unescaped Request body text (avoid for non-text bodies).
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawBody() = FromRequestDslProperty(template.body())
|
||||
/**
|
||||
* Unescaped Request body text (avoid for non-text bodies).
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawBody() = FromRequestDslProperty(template.body())
|
||||
|
||||
/**
|
||||
* Unescaped Request body text for the given JsonPath.
|
||||
* @param jsonPath json path body
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawBody(jsonPath: String) = FromRequestDslProperty(template.body(jsonPath))
|
||||
/**
|
||||
* Unescaped Request body text for the given JsonPath.
|
||||
* @param jsonPath json path body
|
||||
* @return dsl property
|
||||
*/
|
||||
fun rawBody(jsonPath: String) = FromRequestDslProperty(template.body(jsonPath))
|
||||
|
||||
}
|
||||
|
||||
class FromRequestDslProperty(private val content: String) : DslProperty<String>(content) {
|
||||
// Overridden to support String interpolation
|
||||
override fun toString(): String = content
|
||||
// Overridden to support String interpolation
|
||||
override fun toString(): String = content
|
||||
}
|
||||
@@ -22,247 +22,247 @@ package org.springframework.cloud.contract.spec.internal
|
||||
* @author Tim Ysewyn
|
||||
* @since 2.2.0
|
||||
*/
|
||||
open class HeadersDsl: CommonDsl() {
|
||||
open class HeadersDsl : CommonDsl() {
|
||||
|
||||
internal val headers = LinkedHashMap<String, Any>()
|
||||
|
||||
var accept: Any?
|
||||
var accept: Any?
|
||||
get() = headers[HttpHeaders.ACCEPT]
|
||||
set(accept) = storeHeaderValue(HttpHeaders.ACCEPT, matching(accept))
|
||||
|
||||
var acceptCharset: Any?
|
||||
var acceptCharset: Any?
|
||||
get() = headers[HttpHeaders.ACCEPT_CHARSET]
|
||||
set(acceptCharset) = storeHeaderValue(HttpHeaders.ACCEPT_CHARSET, acceptCharset)
|
||||
|
||||
var acceptEncoding: Any?
|
||||
var acceptEncoding: Any?
|
||||
get() = headers[HttpHeaders.ACCEPT_ENCODING]
|
||||
set(acceptEncoding) = storeHeaderValue(HttpHeaders.ACCEPT_ENCODING, acceptEncoding)
|
||||
|
||||
var acceptLanguage: Any?
|
||||
var acceptLanguage: Any?
|
||||
get() = headers[HttpHeaders.ACCEPT_LANGUAGE]
|
||||
set(acceptLanguage) = storeHeaderValue(HttpHeaders.ACCEPT_LANGUAGE, acceptLanguage)
|
||||
|
||||
var acceptRanges: Any?
|
||||
var acceptRanges: Any?
|
||||
get() = headers[HttpHeaders.ACCEPT_RANGES]
|
||||
set(acceptRanges) = storeHeaderValue(HttpHeaders.ACCEPT_RANGES, acceptRanges)
|
||||
|
||||
var accessControlAllowCredentials: Any?
|
||||
var accessControlAllowCredentials: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS]
|
||||
set(accessControlAllowCredentials) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, accessControlAllowCredentials)
|
||||
|
||||
var accessControlAllowHeaders: Any?
|
||||
var accessControlAllowHeaders: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS]
|
||||
set(accessControlAllowHeaders) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, accessControlAllowHeaders)
|
||||
|
||||
var accessControlAllowMethods: Any?
|
||||
var accessControlAllowMethods: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS]
|
||||
set(accessControlAllowMethods) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, accessControlAllowMethods)
|
||||
|
||||
var accessControlAllowOrigin: Any?
|
||||
var accessControlAllowOrigin: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN]
|
||||
set(accessControlAllowOrigin) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, accessControlAllowOrigin)
|
||||
|
||||
var accessControlExposeHeaders: Any?
|
||||
var accessControlExposeHeaders: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS]
|
||||
set(accessControlExposeHeaders) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, accessControlExposeHeaders)
|
||||
|
||||
var accessControlMaxAge: Any?
|
||||
var accessControlMaxAge: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_MAX_AGE]
|
||||
set(accessControlMaxAge) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_MAX_AGE, accessControlMaxAge)
|
||||
|
||||
var accessControlRequestHeaders: Any?
|
||||
var accessControlRequestHeaders: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS]
|
||||
set(accessControlRequestHeaders) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, accessControlRequestHeaders)
|
||||
|
||||
var accessControlRequestMethod: Any?
|
||||
var accessControlRequestMethod: Any?
|
||||
get() = headers[HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD]
|
||||
set(accessControlRequestMethod) = storeHeaderValue(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, accessControlRequestMethod)
|
||||
|
||||
var age: Any?
|
||||
var age: Any?
|
||||
get() = headers[HttpHeaders.AGE]
|
||||
set(age) = storeHeaderValue(HttpHeaders.AGE, age)
|
||||
|
||||
var allow: Any?
|
||||
var allow: Any?
|
||||
get() = headers[HttpHeaders.ALLOW]
|
||||
set(allow) = storeHeaderValue(HttpHeaders.ALLOW, allow)
|
||||
|
||||
var authorization: Any?
|
||||
var authorization: Any?
|
||||
get() = headers[HttpHeaders.AUTHORIZATION]
|
||||
set(authorization) = storeHeaderValue(HttpHeaders.AUTHORIZATION, authorization)
|
||||
|
||||
var cacheControl: Any?
|
||||
var cacheControl: Any?
|
||||
get() = headers[HttpHeaders.CACHE_CONTROL]
|
||||
set(cacheControl) = storeHeaderValue(HttpHeaders.CACHE_CONTROL, cacheControl)
|
||||
|
||||
var connection: Any?
|
||||
var connection: Any?
|
||||
get() = headers[HttpHeaders.CONNECTION]
|
||||
set(connection) = storeHeaderValue(HttpHeaders.CONNECTION, connection)
|
||||
|
||||
var contentEncoding: Any?
|
||||
var contentEncoding: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_ENCODING]
|
||||
set(contentEncoding) = storeHeaderValue(HttpHeaders.CONTENT_ENCODING, contentEncoding)
|
||||
|
||||
var contentDisposition: Any?
|
||||
var contentDisposition: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_DISPOSITION]
|
||||
set(contentDisposition) = storeHeaderValue(HttpHeaders.CONTENT_DISPOSITION, contentDisposition)
|
||||
|
||||
var contentLanguage: Any?
|
||||
var contentLanguage: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_LANGUAGE]
|
||||
set(contentLanguage) = storeHeaderValue(HttpHeaders.CONTENT_LANGUAGE, contentLanguage)
|
||||
|
||||
var contentLength: Any?
|
||||
var contentLength: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_LENGTH]
|
||||
set(contentLength) = storeHeaderValue(HttpHeaders.CONTENT_LENGTH, contentLength)
|
||||
|
||||
var contentLocation: Any?
|
||||
var contentLocation: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_LOCATION]
|
||||
set(contentLocation) = storeHeaderValue(HttpHeaders.CONTENT_LOCATION, contentLocation)
|
||||
|
||||
var contentRange: Any?
|
||||
var contentRange: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_RANGE]
|
||||
set(contentRange) = storeHeaderValue(HttpHeaders.CONTENT_RANGE, contentRange)
|
||||
|
||||
var contentType: Any?
|
||||
var contentType: Any?
|
||||
get() = headers[HttpHeaders.CONTENT_TYPE]
|
||||
set(contentType) = storeHeaderValue(HttpHeaders.CONTENT_TYPE, matching(contentType))
|
||||
|
||||
var cookie: Any?
|
||||
var cookie: Any?
|
||||
get() = headers[HttpHeaders.COOKIE]
|
||||
set(cookie) = storeHeaderValue(HttpHeaders.COOKIE, cookie)
|
||||
|
||||
var date: Any?
|
||||
var date: Any?
|
||||
get() = headers[HttpHeaders.DATE]
|
||||
set(date) = storeHeaderValue(HttpHeaders.DATE, date)
|
||||
|
||||
var etag: Any?
|
||||
var etag: Any?
|
||||
get() = headers[HttpHeaders.ETAG]
|
||||
set(etag) = storeHeaderValue(HttpHeaders.ETAG, etag)
|
||||
|
||||
var expect: Any?
|
||||
var expect: Any?
|
||||
get() = headers[HttpHeaders.EXPECT]
|
||||
set(expect) = storeHeaderValue(HttpHeaders.EXPECT, expect)
|
||||
|
||||
var expires: Any?
|
||||
var expires: Any?
|
||||
get() = headers[HttpHeaders.EXPIRES]
|
||||
set(expires) = storeHeaderValue(HttpHeaders.EXPIRES, expires)
|
||||
|
||||
var from: Any?
|
||||
var from: Any?
|
||||
get() = headers[HttpHeaders.FROM]
|
||||
set(from) = storeHeaderValue(HttpHeaders.FROM, from)
|
||||
|
||||
var host: Any?
|
||||
var host: Any?
|
||||
get() = headers[HttpHeaders.HOST]
|
||||
set(host) = storeHeaderValue(HttpHeaders.HOST, host)
|
||||
|
||||
var ifMatch: Any?
|
||||
var ifMatch: Any?
|
||||
get() = headers[HttpHeaders.IF_MATCH]
|
||||
set(ifMatch) = storeHeaderValue(HttpHeaders.IF_MATCH, ifMatch)
|
||||
|
||||
var ifModifiedSince: Any?
|
||||
var ifModifiedSince: Any?
|
||||
get() = headers[HttpHeaders.IF_MODIFIED_SINCE]
|
||||
set(ifModifiedSince) = storeHeaderValue(HttpHeaders.IF_MODIFIED_SINCE, ifModifiedSince)
|
||||
|
||||
var ifNoneMatch: Any?
|
||||
var ifNoneMatch: Any?
|
||||
get() = headers[HttpHeaders.IF_NONE_MATCH]
|
||||
set(ifNoneMatch) = storeHeaderValue(HttpHeaders.IF_NONE_MATCH, ifNoneMatch)
|
||||
|
||||
var ifRange: Any?
|
||||
var ifRange: Any?
|
||||
get() = headers[HttpHeaders.IF_RANGE]
|
||||
set(ifRange) = storeHeaderValue(HttpHeaders.IF_RANGE, ifRange)
|
||||
|
||||
var ifUnmodifiedSince: Any?
|
||||
var ifUnmodifiedSince: Any?
|
||||
get() = headers[HttpHeaders.IF_UNMODIFIED_SINCE]
|
||||
set(ifUnmodifiedSince) = storeHeaderValue(HttpHeaders.IF_UNMODIFIED_SINCE, ifUnmodifiedSince)
|
||||
|
||||
var lastModified: Any?
|
||||
var lastModified: Any?
|
||||
get() = headers[HttpHeaders.LAST_MODIFIED]
|
||||
set(lastModified) = storeHeaderValue(HttpHeaders.LAST_MODIFIED, lastModified)
|
||||
|
||||
var link: Any?
|
||||
var link: Any?
|
||||
get() = headers[HttpHeaders.LINK]
|
||||
set(link) = storeHeaderValue(HttpHeaders.LINK, link)
|
||||
|
||||
var location: Any?
|
||||
var location: Any?
|
||||
get() = headers[HttpHeaders.LOCATION]
|
||||
set(location) = storeHeaderValue(HttpHeaders.LOCATION, location)
|
||||
|
||||
var max_forwards: Any?
|
||||
var max_forwards: Any?
|
||||
get() = headers[HttpHeaders.MAX_FORWARDS]
|
||||
set(max_forwards) = storeHeaderValue(HttpHeaders.MAX_FORWARDS, max_forwards)
|
||||
|
||||
var origin: Any?
|
||||
var origin: Any?
|
||||
get() = headers[HttpHeaders.ORIGIN]
|
||||
set(origin) = storeHeaderValue(HttpHeaders.ORIGIN, origin)
|
||||
|
||||
var pragma: Any?
|
||||
var pragma: Any?
|
||||
get() = headers[HttpHeaders.PRAGMA]
|
||||
set(pragma) = storeHeaderValue(HttpHeaders.PRAGMA, pragma)
|
||||
|
||||
var proxyAuthenticate: Any?
|
||||
var proxyAuthenticate: Any?
|
||||
get() = headers[HttpHeaders.PROXY_AUTHENTICATE]
|
||||
set(proxyAuthenticate) = storeHeaderValue(HttpHeaders.PROXY_AUTHENTICATE, proxyAuthenticate)
|
||||
|
||||
var proxyAuthorization: Any?
|
||||
var proxyAuthorization: Any?
|
||||
get() = headers[HttpHeaders.PROXY_AUTHORIZATION]
|
||||
set(proxyAuthorization) = storeHeaderValue(HttpHeaders.PROXY_AUTHORIZATION, proxyAuthorization)
|
||||
|
||||
var range: Any?
|
||||
var range: Any?
|
||||
get() = headers[HttpHeaders.RANGE]
|
||||
set(range) = storeHeaderValue(HttpHeaders.RANGE, range)
|
||||
|
||||
var referer: Any?
|
||||
var referer: Any?
|
||||
get() = headers[HttpHeaders.REFERER]
|
||||
set(referer) = storeHeaderValue(HttpHeaders.REFERER, referer)
|
||||
|
||||
var retryAfter: Any?
|
||||
var retryAfter: Any?
|
||||
get() = headers[HttpHeaders.RETRY_AFTER]
|
||||
set(retryAfter) = storeHeaderValue(HttpHeaders.RETRY_AFTER, retryAfter)
|
||||
|
||||
var server: Any?
|
||||
var server: Any?
|
||||
get() = headers[HttpHeaders.SERVER]
|
||||
set(server) = storeHeaderValue(HttpHeaders.SERVER, server)
|
||||
|
||||
var setCookie: Any?
|
||||
var setCookie: Any?
|
||||
get() = headers[HttpHeaders.SET_COOKIE]
|
||||
set(setCookie) = storeHeaderValue(HttpHeaders.SET_COOKIE, setCookie)
|
||||
|
||||
var setCookie2: Any?
|
||||
var setCookie2: Any?
|
||||
get() = headers[HttpHeaders.SET_COOKIE_2]
|
||||
set(setCookie2) = storeHeaderValue(HttpHeaders.SET_COOKIE_2, setCookie2)
|
||||
|
||||
var te: Any?
|
||||
var te: Any?
|
||||
get() = headers[HttpHeaders.TE]
|
||||
set(te) = storeHeaderValue(HttpHeaders.TE, te)
|
||||
|
||||
var trailer: Any?
|
||||
var trailer: Any?
|
||||
get() = headers[HttpHeaders.TRAILER]
|
||||
set(trailer) = storeHeaderValue(HttpHeaders.TRAILER, trailer)
|
||||
|
||||
var transferEncoding: Any?
|
||||
var transferEncoding: Any?
|
||||
get() = headers[HttpHeaders.TRANSFER_ENCODING]
|
||||
set(transferEncoding) = storeHeaderValue(HttpHeaders.TRANSFER_ENCODING, transferEncoding)
|
||||
|
||||
var upgrade: Any?
|
||||
var upgrade: Any?
|
||||
get() = headers[HttpHeaders.UPGRADE]
|
||||
set(upgrade) = storeHeaderValue(HttpHeaders.UPGRADE, upgrade)
|
||||
|
||||
var user_agent: Any?
|
||||
var user_agent: Any?
|
||||
get() = headers[HttpHeaders.USER_AGENT]
|
||||
set(user_agent) = storeHeaderValue(HttpHeaders.USER_AGENT, user_agent)
|
||||
|
||||
var vary: Any?
|
||||
var vary: Any?
|
||||
get() = headers[HttpHeaders.VARY]
|
||||
set(vary) = storeHeaderValue(HttpHeaders.VARY, vary)
|
||||
|
||||
var via: Any?
|
||||
var via: Any?
|
||||
get() = headers[HttpHeaders.VIA]
|
||||
set(via) = storeHeaderValue(HttpHeaders.VIA, via)
|
||||
|
||||
var warning: Any?
|
||||
var warning: Any?
|
||||
get() = headers[HttpHeaders.WARNING]
|
||||
set(warning) = storeHeaderValue(HttpHeaders.WARNING, warning)
|
||||
|
||||
var wwwAuthenticate: Any?
|
||||
var wwwAuthenticate: Any?
|
||||
get() = headers[HttpHeaders.WWW_AUTHENTICATE]
|
||||
set(wwwAuthenticate) = storeHeaderValue(HttpHeaders.WWW_AUTHENTICATE, wwwAuthenticate)
|
||||
|
||||
@@ -270,139 +270,139 @@ open class HeadersDsl: CommonDsl() {
|
||||
get() = headers[MessagingHeaders.MESSAGING_CONTENT_TYPE]
|
||||
set(messagingContentType) = storeHeaderValue(MessagingHeaders.MESSAGING_CONTENT_TYPE, matching(messagingContentType))
|
||||
|
||||
open fun matching(value: Any?): Any? = value
|
||||
|
||||
private fun storeHeaderValue(header: String, value: Any?) {
|
||||
open fun matching(value: Any?): Any? = value
|
||||
|
||||
private fun storeHeaderValue(header: String, value: Any?) {
|
||||
value?.also { headers[header] = value }
|
||||
}
|
||||
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
/* HTTP HEADERS */
|
||||
/* HTTP HEADERS */
|
||||
|
||||
val ACCEPT = HttpHeaders.ACCEPT
|
||||
val ACCEPT = HttpHeaders.ACCEPT
|
||||
|
||||
val ACCEPT_CHARSET = HttpHeaders.ACCEPT_CHARSET
|
||||
val ACCEPT_CHARSET = HttpHeaders.ACCEPT_CHARSET
|
||||
|
||||
val ACCEPT_ENCODING = HttpHeaders.ACCEPT_ENCODING
|
||||
val ACCEPT_ENCODING = HttpHeaders.ACCEPT_ENCODING
|
||||
|
||||
val ACCEPT_LANGUAGE = HttpHeaders.ACCEPT_LANGUAGE
|
||||
val ACCEPT_LANGUAGE = HttpHeaders.ACCEPT_LANGUAGE
|
||||
|
||||
val ACCEPT_RANGES = HttpHeaders.ACCEPT_RANGES
|
||||
val ACCEPT_RANGES = HttpHeaders.ACCEPT_RANGES
|
||||
|
||||
val ACCESS_CONTROL_ALLOW_CREDENTIALS = HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS
|
||||
val ACCESS_CONTROL_ALLOW_CREDENTIALS = HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS
|
||||
|
||||
val ACCESS_CONTROL_ALLOW_HEADERS = HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS
|
||||
val ACCESS_CONTROL_ALLOW_HEADERS = HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS
|
||||
|
||||
val ACCESS_CONTROL_ALLOW_METHODS = HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS
|
||||
val ACCESS_CONTROL_ALLOW_METHODS = HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS
|
||||
|
||||
val ACCESS_CONTROL_ALLOW_ORIGIN = HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN
|
||||
val ACCESS_CONTROL_ALLOW_ORIGIN = HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN
|
||||
|
||||
val ACCESS_CONTROL_EXPOSE_HEADERS = HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS
|
||||
val ACCESS_CONTROL_EXPOSE_HEADERS = HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS
|
||||
|
||||
val ACCESS_CONTROL_MAX_AGE = HttpHeaders.ACCESS_CONTROL_MAX_AGE
|
||||
val ACCESS_CONTROL_MAX_AGE = HttpHeaders.ACCESS_CONTROL_MAX_AGE
|
||||
|
||||
val ACCESS_CONTROL_REQUEST_HEADERS = HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS
|
||||
val ACCESS_CONTROL_REQUEST_HEADERS = HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS
|
||||
|
||||
val ACCESS_CONTROL_REQUEST_METHOD = HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD
|
||||
val ACCESS_CONTROL_REQUEST_METHOD = HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD
|
||||
|
||||
val AGE = HttpHeaders.AGE
|
||||
val AGE = HttpHeaders.AGE
|
||||
|
||||
val ALLOW = HttpHeaders.ALLOW
|
||||
val ALLOW = HttpHeaders.ALLOW
|
||||
|
||||
val AUTHORIZATION = HttpHeaders.AUTHORIZATION
|
||||
val AUTHORIZATION = HttpHeaders.AUTHORIZATION
|
||||
|
||||
val CACHE_CONTROL = HttpHeaders.CACHE_CONTROL
|
||||
val CACHE_CONTROL = HttpHeaders.CACHE_CONTROL
|
||||
|
||||
val CONNECTION = HttpHeaders.CONNECTION
|
||||
val CONNECTION = HttpHeaders.CONNECTION
|
||||
|
||||
val CONTENT_ENCODING = HttpHeaders.CONTENT_ENCODING
|
||||
val CONTENT_ENCODING = HttpHeaders.CONTENT_ENCODING
|
||||
|
||||
val CONTENT_DISPOSITION = HttpHeaders.CONTENT_DISPOSITION
|
||||
val CONTENT_DISPOSITION = HttpHeaders.CONTENT_DISPOSITION
|
||||
|
||||
val CONTENT_LANGUAGE = HttpHeaders.CONTENT_LANGUAGE
|
||||
val CONTENT_LANGUAGE = HttpHeaders.CONTENT_LANGUAGE
|
||||
|
||||
val CONTENT_LENGTH = HttpHeaders.CONTENT_LENGTH
|
||||
val CONTENT_LENGTH = HttpHeaders.CONTENT_LENGTH
|
||||
|
||||
val CONTENT_LOCATION = HttpHeaders.CONTENT_LOCATION
|
||||
val CONTENT_LOCATION = HttpHeaders.CONTENT_LOCATION
|
||||
|
||||
val CONTENT_RANGE = HttpHeaders.CONTENT_RANGE
|
||||
val CONTENT_RANGE = HttpHeaders.CONTENT_RANGE
|
||||
|
||||
val CONTENT_TYPE = HttpHeaders.CONTENT_TYPE
|
||||
val CONTENT_TYPE = HttpHeaders.CONTENT_TYPE
|
||||
|
||||
val COOKIE = HttpHeaders.COOKIE
|
||||
val COOKIE = HttpHeaders.COOKIE
|
||||
|
||||
val DATE = HttpHeaders.DATE
|
||||
val DATE = HttpHeaders.DATE
|
||||
|
||||
val ETAG = HttpHeaders.ETAG
|
||||
val ETAG = HttpHeaders.ETAG
|
||||
|
||||
val EXPECT = HttpHeaders.EXPECT
|
||||
val EXPECT = HttpHeaders.EXPECT
|
||||
|
||||
val EXPIRES = HttpHeaders.EXPIRES
|
||||
val EXPIRES = HttpHeaders.EXPIRES
|
||||
|
||||
val FROM = HttpHeaders.FROM
|
||||
val FROM = HttpHeaders.FROM
|
||||
|
||||
val HOST = HttpHeaders.HOST
|
||||
val HOST = HttpHeaders.HOST
|
||||
|
||||
val IF_MATCH = HttpHeaders.IF_MATCH
|
||||
val IF_MATCH = HttpHeaders.IF_MATCH
|
||||
|
||||
val IF_MODIFIED_SINCE = HttpHeaders.IF_MODIFIED_SINCE
|
||||
val IF_MODIFIED_SINCE = HttpHeaders.IF_MODIFIED_SINCE
|
||||
|
||||
val IF_NONE_MATCH = HttpHeaders.IF_NONE_MATCH
|
||||
val IF_NONE_MATCH = HttpHeaders.IF_NONE_MATCH
|
||||
|
||||
val IF_RANGE = HttpHeaders.IF_RANGE
|
||||
val IF_RANGE = HttpHeaders.IF_RANGE
|
||||
|
||||
val IF_UNMODIFIED_SINCE = HttpHeaders.IF_UNMODIFIED_SINCE
|
||||
val IF_UNMODIFIED_SINCE = HttpHeaders.IF_UNMODIFIED_SINCE
|
||||
|
||||
val LAST_MODIFIED = HttpHeaders.LAST_MODIFIED
|
||||
val LAST_MODIFIED = HttpHeaders.LAST_MODIFIED
|
||||
|
||||
val LINK = HttpHeaders.LINK
|
||||
val LINK = HttpHeaders.LINK
|
||||
|
||||
val LOCATION = HttpHeaders.LOCATION
|
||||
val LOCATION = HttpHeaders.LOCATION
|
||||
|
||||
val MAX_FORWARDS = HttpHeaders.MAX_FORWARDS
|
||||
val MAX_FORWARDS = HttpHeaders.MAX_FORWARDS
|
||||
|
||||
val ORIGIN = HttpHeaders.ORIGIN
|
||||
val ORIGIN = HttpHeaders.ORIGIN
|
||||
|
||||
val PRAGMA = HttpHeaders.PRAGMA
|
||||
val PRAGMA = HttpHeaders.PRAGMA
|
||||
|
||||
val PROXY_AUTHENTICATE = HttpHeaders.PROXY_AUTHENTICATE
|
||||
val PROXY_AUTHENTICATE = HttpHeaders.PROXY_AUTHENTICATE
|
||||
|
||||
val PROXY_AUTHORIZATION = HttpHeaders.PROXY_AUTHORIZATION
|
||||
val PROXY_AUTHORIZATION = HttpHeaders.PROXY_AUTHORIZATION
|
||||
|
||||
val RANGE = HttpHeaders.RANGE
|
||||
val RANGE = HttpHeaders.RANGE
|
||||
|
||||
val REFERER = HttpHeaders.REFERER
|
||||
val REFERER = HttpHeaders.REFERER
|
||||
|
||||
val RETRY_AFTER = HttpHeaders.RETRY_AFTER
|
||||
val RETRY_AFTER = HttpHeaders.RETRY_AFTER
|
||||
|
||||
val SERVER = HttpHeaders.SERVER
|
||||
val SERVER = HttpHeaders.SERVER
|
||||
|
||||
val SET_COOKIE = HttpHeaders.SET_COOKIE
|
||||
val SET_COOKIE = HttpHeaders.SET_COOKIE
|
||||
|
||||
val SET_COOKIE_2 = HttpHeaders.SET_COOKIE_2
|
||||
val SET_COOKIE_2 = HttpHeaders.SET_COOKIE_2
|
||||
|
||||
val TE = HttpHeaders.TE
|
||||
val TE = HttpHeaders.TE
|
||||
|
||||
val TRAILER = HttpHeaders.TRAILER
|
||||
val TRAILER = HttpHeaders.TRAILER
|
||||
|
||||
val TRANSFER_ENCODING = HttpHeaders.TRANSFER_ENCODING
|
||||
val TRANSFER_ENCODING = HttpHeaders.TRANSFER_ENCODING
|
||||
|
||||
val UPGRADE = HttpHeaders.UPGRADE
|
||||
val UPGRADE = HttpHeaders.UPGRADE
|
||||
|
||||
val USER_AGENT = HttpHeaders.USER_AGENT
|
||||
val USER_AGENT = HttpHeaders.USER_AGENT
|
||||
|
||||
val VARY = HttpHeaders.VARY
|
||||
val VARY = HttpHeaders.VARY
|
||||
|
||||
val VIA = HttpHeaders.VIA
|
||||
val VIA = HttpHeaders.VIA
|
||||
|
||||
val WARNING = HttpHeaders.WARNING
|
||||
val WARNING = HttpHeaders.WARNING
|
||||
|
||||
val WWW_AUTHENTICATE = HttpHeaders.WWW_AUTHENTICATE
|
||||
val WWW_AUTHENTICATE = HttpHeaders.WWW_AUTHENTICATE
|
||||
|
||||
/* MESSAGING HEADERS */
|
||||
/* MESSAGING HEADERS */
|
||||
|
||||
val MESSAGING_CONTENT_TYPE = MessagingHeaders.MESSAGING_CONTENT_TYPE
|
||||
val MESSAGING_CONTENT_TYPE = MessagingHeaders.MESSAGING_CONTENT_TYPE
|
||||
|
||||
/* MEDIA TYPES */
|
||||
|
||||
@@ -440,15 +440,15 @@ open class HeadersDsl: CommonDsl() {
|
||||
|
||||
val TEXT_XML = MediaTypes.TEXT_XML
|
||||
|
||||
/**
|
||||
* Adds a header.
|
||||
*
|
||||
* @param name The name of the header.
|
||||
* @param value The value of the header.
|
||||
*/
|
||||
fun header(name: String, value: Any) {
|
||||
this.headers[name] = value
|
||||
}
|
||||
/**
|
||||
* Adds a header.
|
||||
*
|
||||
* @param name The name of the header.
|
||||
* @param value The value of the header.
|
||||
*/
|
||||
fun header(name: String, value: Any) {
|
||||
this.headers[name] = value
|
||||
}
|
||||
|
||||
internal fun get(): Headers {
|
||||
val headers = Headers()
|
||||
|
||||
@@ -28,7 +28,7 @@ import javax.script.ScriptEngineManager
|
||||
* @author Tim Ysewyn
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class KotlinContractConverter: ContractConverter<List<Contract>> {
|
||||
class KotlinContractConverter : ContractConverter<List<Contract>> {
|
||||
|
||||
private val ext = "kts"
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ import org.springframework.cloud.contract.spec.toDslProperty
|
||||
*/
|
||||
class MultipartDsl {
|
||||
|
||||
private val fields = LinkedHashMap<String, DslProperty<Any>>()
|
||||
private val fields = LinkedHashMap<String, DslProperty<Any>>()
|
||||
|
||||
fun field(name: String, content: Any) {
|
||||
this.fields[name] = content.toDslProperty()
|
||||
}
|
||||
fun field(name: String, content: Any) {
|
||||
this.fields[name] = content.toDslProperty()
|
||||
}
|
||||
|
||||
internal fun get(): Multipart {
|
||||
return Multipart(fields)
|
||||
}
|
||||
internal fun get(): Multipart {
|
||||
return Multipart(fields)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import java.util.regex.Pattern
|
||||
*/
|
||||
@ContractDslMarker
|
||||
open class RequestDsl : CommonDsl() {
|
||||
|
||||
|
||||
private val delegate = Request()
|
||||
|
||||
/**
|
||||
@@ -293,13 +293,13 @@ open class RequestDsl : CommonDsl() {
|
||||
return request
|
||||
}
|
||||
|
||||
private class RequestHeadersDsl: HeadersDsl() {
|
||||
private class RequestHeadersDsl : HeadersDsl() {
|
||||
|
||||
private val common = Common()
|
||||
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when(value) {
|
||||
return when (value) {
|
||||
is String -> this.common.value(
|
||||
c(regex(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*")),
|
||||
p(value)
|
||||
@@ -311,13 +311,13 @@ open class RequestDsl : CommonDsl() {
|
||||
|
||||
}
|
||||
|
||||
private class RequestCookiesDsl: CookiesDsl() {
|
||||
private class RequestCookiesDsl : CookiesDsl() {
|
||||
|
||||
private val common = Common()
|
||||
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when(value) {
|
||||
return when (value) {
|
||||
is String -> this.common.value(
|
||||
c(regex(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*")),
|
||||
p(value)
|
||||
|
||||
@@ -22,19 +22,19 @@ package org.springframework.cloud.contract.spec.internal
|
||||
* @author Tim Ysewyn
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class ResponseBodyMatchersDsl: BodyMatchersDsl() {
|
||||
class ResponseBodyMatchersDsl : BodyMatchersDsl() {
|
||||
|
||||
val byType
|
||||
val byType
|
||||
get() = MatchingTypeValue(MatchingType.TYPE)
|
||||
|
||||
val byNull
|
||||
val byNull
|
||||
get() = MatchingTypeValue(MatchingType.NULL)
|
||||
|
||||
fun byCommand(execute: String) = MatchingTypeValue().apply {
|
||||
type = MatchingType.COMMAND
|
||||
value = ExecutionProperty(execute)
|
||||
}
|
||||
fun byCommand(execute: String) = MatchingTypeValue().apply {
|
||||
type = MatchingType.COMMAND
|
||||
value = ExecutionProperty(execute)
|
||||
}
|
||||
|
||||
override fun get() = configureBodyMatchers(ResponseBodyMatchers())
|
||||
override fun get() = configureBodyMatchers(ResponseBodyMatchers())
|
||||
|
||||
}
|
||||
@@ -32,40 +32,40 @@ class ResponseDsl : CommonDsl() {
|
||||
|
||||
private val delegate = Response()
|
||||
|
||||
/**
|
||||
* The HTTP response status.
|
||||
*/
|
||||
var status: DslProperty<Any>? = null
|
||||
/**
|
||||
* The HTTP response status.
|
||||
*/
|
||||
var status: DslProperty<Any>? = null
|
||||
|
||||
/**
|
||||
* The HTTP response delay in milliseconds.
|
||||
*/
|
||||
var delay: DslProperty<Any>? = null
|
||||
/**
|
||||
* The HTTP response delay in milliseconds.
|
||||
*/
|
||||
var delay: DslProperty<Any>? = null
|
||||
|
||||
/**
|
||||
* The HTTP response headers.
|
||||
*/
|
||||
var headers: Headers? = null
|
||||
/**
|
||||
* The HTTP response headers.
|
||||
*/
|
||||
var headers: Headers? = null
|
||||
|
||||
/**
|
||||
* The HTTP response cookies.
|
||||
*/
|
||||
var cookies: Cookies? = null
|
||||
/**
|
||||
* The HTTP response cookies.
|
||||
*/
|
||||
var cookies: Cookies? = null
|
||||
|
||||
/**
|
||||
* The HTTP response body.
|
||||
*/
|
||||
var body: Body? = null
|
||||
/**
|
||||
* The HTTP response body.
|
||||
*/
|
||||
var body: Body? = null
|
||||
|
||||
/**
|
||||
* Indicates asynchronous communication.
|
||||
*/
|
||||
var async: Boolean = false
|
||||
/**
|
||||
* Indicates asynchronous communication.
|
||||
*/
|
||||
var async: Boolean = false
|
||||
|
||||
/**
|
||||
* The HTTP response body matchers.
|
||||
*/
|
||||
var bodyMatchers: ResponseBodyMatchers? = null
|
||||
/**
|
||||
* The HTTP response body matchers.
|
||||
*/
|
||||
var bodyMatchers: ResponseBodyMatchers? = null
|
||||
|
||||
fun code(code: Int): DslProperty<Any> = code.toDslProperty()
|
||||
|
||||
@@ -75,9 +75,9 @@ class ResponseDsl : CommonDsl() {
|
||||
this.headers = ResponseHeadersDsl().apply(headers).get()
|
||||
}
|
||||
|
||||
fun cookies(cookies: CookiesDsl.() -> Unit) {
|
||||
this.cookies = ResponseCookiesDsl().apply(cookies).get()
|
||||
}
|
||||
fun cookies(cookies: CookiesDsl.() -> Unit) {
|
||||
this.cookies = ResponseCookiesDsl().apply(cookies).get()
|
||||
}
|
||||
|
||||
fun body(body: Map<String, Any>) = Body(body.toDslProperties())
|
||||
|
||||
@@ -89,251 +89,251 @@ class ResponseDsl : CommonDsl() {
|
||||
|
||||
fun body(body: Any) = Body(body)
|
||||
|
||||
fun bodyMatchers(configurer: ResponseBodyMatchersDsl.() -> Unit) {
|
||||
bodyMatchers = ResponseBodyMatchersDsl().apply(configurer).get()
|
||||
}
|
||||
fun bodyMatchers(configurer: ResponseBodyMatchersDsl.() -> Unit) {
|
||||
bodyMatchers = ResponseBodyMatchersDsl().apply(configurer).get()
|
||||
}
|
||||
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
/* HTTP STATUS CODES */
|
||||
|
||||
|
||||
val CONTINUE
|
||||
get() = code(HttpStatus.CONTINUE)
|
||||
|
||||
val SWITCHING_PROTOCOLS
|
||||
val SWITCHING_PROTOCOLS
|
||||
get() = code(HttpStatus.SWITCHING_PROTOCOLS)
|
||||
|
||||
val PROCESSING
|
||||
val PROCESSING
|
||||
get() = code(HttpStatus.PROCESSING)
|
||||
|
||||
val CHECKPOINT
|
||||
val CHECKPOINT
|
||||
get() = code(HttpStatus.CHECKPOINT)
|
||||
|
||||
val OK
|
||||
get() = code(HttpStatus.OK)
|
||||
|
||||
val CREATED
|
||||
val CREATED
|
||||
get() = code(HttpStatus.CREATED)
|
||||
|
||||
val ACCEPTED
|
||||
val ACCEPTED
|
||||
get() = code(HttpStatus.ACCEPTED)
|
||||
|
||||
val NON_AUTHORITATIVE_INFORMATION
|
||||
val NON_AUTHORITATIVE_INFORMATION
|
||||
get() = code(HttpStatus.NON_AUTHORITATIVE_INFORMATION)
|
||||
|
||||
val NO_CONTENT
|
||||
val NO_CONTENT
|
||||
get() = code(HttpStatus.NO_CONTENT)
|
||||
|
||||
val RESET_CONTENT
|
||||
val RESET_CONTENT
|
||||
get() = code(HttpStatus.RESET_CONTENT)
|
||||
|
||||
val PARTIAL_CONTENT
|
||||
val PARTIAL_CONTENT
|
||||
get() = code(HttpStatus.PARTIAL_CONTENT)
|
||||
|
||||
val MULTI_STATUS
|
||||
val MULTI_STATUS
|
||||
get() = code(HttpStatus.MULTI_STATUS)
|
||||
|
||||
val ALREADY_REPORTED
|
||||
val ALREADY_REPORTED
|
||||
get() = code(HttpStatus.ALREADY_REPORTED)
|
||||
|
||||
val IM_USED
|
||||
val IM_USED
|
||||
get() = code(HttpStatus.IM_USED)
|
||||
|
||||
val MULTIPLE_CHOICES
|
||||
val MULTIPLE_CHOICES
|
||||
get() = code(HttpStatus.MULTIPLE_CHOICES)
|
||||
|
||||
val MOVED_PERMANENTLY
|
||||
val MOVED_PERMANENTLY
|
||||
get() = code(HttpStatus.MOVED_PERMANENTLY)
|
||||
|
||||
val FOUND
|
||||
val FOUND
|
||||
get() = code(HttpStatus.FOUND)
|
||||
|
||||
val SEE_OTHER
|
||||
val SEE_OTHER
|
||||
get() = code(HttpStatus.SEE_OTHER)
|
||||
|
||||
val NOT_MODIFIED
|
||||
val NOT_MODIFIED
|
||||
get() = code(HttpStatus.NOT_MODIFIED)
|
||||
|
||||
val TEMPORARY_REDIRECT
|
||||
val TEMPORARY_REDIRECT
|
||||
get() = code(HttpStatus.TEMPORARY_REDIRECT)
|
||||
|
||||
val PERMANENT_REDIRECT
|
||||
val PERMANENT_REDIRECT
|
||||
get() = code(HttpStatus.PERMANENT_REDIRECT)
|
||||
|
||||
val BAD_REQUEST
|
||||
val BAD_REQUEST
|
||||
get() = code(HttpStatus.BAD_REQUEST)
|
||||
|
||||
val UNAUTHORIZED
|
||||
val UNAUTHORIZED
|
||||
get() = code(HttpStatus.UNAUTHORIZED)
|
||||
|
||||
val PAYMENT_REQUIRED
|
||||
val PAYMENT_REQUIRED
|
||||
get() = code(HttpStatus.PAYMENT_REQUIRED)
|
||||
|
||||
val FORBIDDEN
|
||||
val FORBIDDEN
|
||||
get() = code(HttpStatus.FORBIDDEN)
|
||||
|
||||
val NOT_FOUND
|
||||
val NOT_FOUND
|
||||
get() = code(HttpStatus.NOT_FOUND)
|
||||
|
||||
val METHOD_NOT_ALLOWED
|
||||
val METHOD_NOT_ALLOWED
|
||||
get() = code(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
|
||||
val NOT_ACCEPTABLE
|
||||
val NOT_ACCEPTABLE
|
||||
get() = code(HttpStatus.NOT_ACCEPTABLE)
|
||||
|
||||
val PROXY_AUTHENTICATION_REQUIRED
|
||||
val PROXY_AUTHENTICATION_REQUIRED
|
||||
get() = code(HttpStatus.PROXY_AUTHENTICATION_REQUIRED)
|
||||
|
||||
val REQUEST_TIMEOUT
|
||||
val REQUEST_TIMEOUT
|
||||
get() = code(HttpStatus.REQUEST_TIMEOUT)
|
||||
|
||||
val CONFLICT
|
||||
val CONFLICT
|
||||
get() = code(HttpStatus.CONFLICT)
|
||||
|
||||
val GONE
|
||||
val GONE
|
||||
get() = code(HttpStatus.GONE)
|
||||
|
||||
val LENGTH_REQUIRED
|
||||
val LENGTH_REQUIRED
|
||||
get() = code(HttpStatus.LENGTH_REQUIRED)
|
||||
|
||||
val PRECONDITION_FAILED
|
||||
val PRECONDITION_FAILED
|
||||
get() = code(HttpStatus.PRECONDITION_FAILED)
|
||||
|
||||
val PAYLOAD_TOO_LARGE
|
||||
val PAYLOAD_TOO_LARGE
|
||||
get() = code(HttpStatus.PAYLOAD_TOO_LARGE)
|
||||
|
||||
val UNSUPPORTED_MEDIA_TYPE
|
||||
val UNSUPPORTED_MEDIA_TYPE
|
||||
get() = code(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
|
||||
|
||||
val REQUESTED_RANGE_NOT_SATISFIABLE
|
||||
val REQUESTED_RANGE_NOT_SATISFIABLE
|
||||
get() = code(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE)
|
||||
|
||||
val EXPECTATION_FAILED
|
||||
val EXPECTATION_FAILED
|
||||
get() = code(HttpStatus.EXPECTATION_FAILED)
|
||||
|
||||
val I_AM_A_TEAPOT
|
||||
val I_AM_A_TEAPOT
|
||||
get() = code(HttpStatus.I_AM_A_TEAPOT)
|
||||
|
||||
val UNPROCESSABLE_ENTITY
|
||||
val UNPROCESSABLE_ENTITY
|
||||
get() = code(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
|
||||
val LOCKED
|
||||
val LOCKED
|
||||
get() = code(HttpStatus.LOCKED)
|
||||
|
||||
val FAILED_DEPENDENCY
|
||||
val FAILED_DEPENDENCY
|
||||
get() = code(HttpStatus.FAILED_DEPENDENCY)
|
||||
|
||||
val UPGRADE_REQUIRED
|
||||
val UPGRADE_REQUIRED
|
||||
get() = code(HttpStatus.UPGRADE_REQUIRED)
|
||||
|
||||
val PRECONDITION_REQUIRED
|
||||
val PRECONDITION_REQUIRED
|
||||
get() = code(HttpStatus.PRECONDITION_REQUIRED)
|
||||
|
||||
val TOO_MANY_REQUESTS
|
||||
val TOO_MANY_REQUESTS
|
||||
get() = code(HttpStatus.TOO_MANY_REQUESTS)
|
||||
|
||||
val REQUEST_HEADER_FIELDS_TOO_LARGE
|
||||
val REQUEST_HEADER_FIELDS_TOO_LARGE
|
||||
get() = code(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE)
|
||||
|
||||
val UNAVAILABLE_FOR_LEGAL_REASONS
|
||||
val UNAVAILABLE_FOR_LEGAL_REASONS
|
||||
get() = code(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS)
|
||||
|
||||
val INTERNAL_SERVER_ERROR
|
||||
val INTERNAL_SERVER_ERROR
|
||||
get() = code(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
|
||||
val NOT_IMPLEMENTED
|
||||
val NOT_IMPLEMENTED
|
||||
get() = code(HttpStatus.NOT_IMPLEMENTED)
|
||||
|
||||
val BAD_GATEWAY
|
||||
val BAD_GATEWAY
|
||||
get() = code(HttpStatus.BAD_GATEWAY)
|
||||
|
||||
val SERVICE_UNAVAILABLE
|
||||
val SERVICE_UNAVAILABLE
|
||||
get() = code(HttpStatus.SERVICE_UNAVAILABLE)
|
||||
|
||||
val GATEWAY_TIMEOUT
|
||||
val GATEWAY_TIMEOUT
|
||||
get() = code(HttpStatus.GATEWAY_TIMEOUT)
|
||||
|
||||
val HTTP_VERSION_NOT_SUPPORTED
|
||||
val HTTP_VERSION_NOT_SUPPORTED
|
||||
get() = code(HttpStatus.HTTP_VERSION_NOT_SUPPORTED)
|
||||
|
||||
val VARIANT_ALSO_NEGOTIATES
|
||||
val VARIANT_ALSO_NEGOTIATES
|
||||
get() = code(HttpStatus.VARIANT_ALSO_NEGOTIATES)
|
||||
|
||||
val INSUFFICIENT_STORAGE
|
||||
val INSUFFICIENT_STORAGE
|
||||
get() = code(HttpStatus.INSUFFICIENT_STORAGE)
|
||||
|
||||
val LOOP_DETECTED
|
||||
val LOOP_DETECTED
|
||||
get() = code(HttpStatus.LOOP_DETECTED)
|
||||
|
||||
val BANDWIDTH_LIMIT_EXCEEDED
|
||||
val BANDWIDTH_LIMIT_EXCEEDED
|
||||
get() = code(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED)
|
||||
|
||||
val NOT_EXTENDED
|
||||
val NOT_EXTENDED
|
||||
get() = code(HttpStatus.NOT_EXTENDED)
|
||||
|
||||
val NETWORK_AUTHENTICATION_REQUIRED
|
||||
val NETWORK_AUTHENTICATION_REQUIRED
|
||||
get() = code(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED)
|
||||
|
||||
/* REGEX */
|
||||
/* REGEX */
|
||||
|
||||
val anyAlphaUnicode
|
||||
val anyAlphaUnicode
|
||||
get() = delegate.anyAlphaUnicode()
|
||||
|
||||
val anyAlphaNumeric
|
||||
val anyAlphaNumeric
|
||||
get() = delegate.anyAlphaNumeric()
|
||||
|
||||
val anyNumber
|
||||
val anyNumber
|
||||
get() = delegate.anyNumber()
|
||||
|
||||
val anyInteger
|
||||
val anyInteger
|
||||
get() = delegate.anyInteger()
|
||||
|
||||
val anyPositiveInt
|
||||
val anyPositiveInt
|
||||
get() = delegate.anyPositiveInt()
|
||||
|
||||
val anyDouble
|
||||
val anyDouble
|
||||
get() = delegate.anyDouble()
|
||||
|
||||
val anyHex
|
||||
val anyHex
|
||||
get() = delegate.anyHex()
|
||||
|
||||
val aBoolean
|
||||
val aBoolean
|
||||
get() = delegate.aBoolean()
|
||||
|
||||
val anyIpAddress
|
||||
val anyIpAddress
|
||||
get() = delegate.anyIpAddress()
|
||||
|
||||
val anyHostname
|
||||
val anyHostname
|
||||
get() = delegate.anyHostname()
|
||||
|
||||
val anyEmail
|
||||
val anyEmail
|
||||
get() = delegate.anyEmail()
|
||||
|
||||
val anyUrl
|
||||
val anyUrl
|
||||
get() = delegate.anyUrl()
|
||||
|
||||
val anyHttpsUrl
|
||||
val anyHttpsUrl
|
||||
get() = delegate.anyHttpsUrl()
|
||||
|
||||
val anyUuid
|
||||
val anyUuid
|
||||
get() = delegate.anyUuid()
|
||||
|
||||
val anyDate
|
||||
val anyDate
|
||||
get() = delegate.anyDate()
|
||||
|
||||
val anyDateTime
|
||||
val anyDateTime
|
||||
get() = delegate.anyDateTime()
|
||||
|
||||
val anyTime
|
||||
val anyTime
|
||||
get() = delegate.anyTime()
|
||||
|
||||
val anyIso8601WithOffset
|
||||
val anyIso8601WithOffset
|
||||
get() = delegate.anyIso8601WithOffset()
|
||||
|
||||
val anyNonBlankString
|
||||
val anyNonBlankString
|
||||
get() = delegate.anyNonBlankString()
|
||||
|
||||
val anyNonEmptyString
|
||||
val anyNonEmptyString
|
||||
get() = delegate.anyNonEmptyString()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
@@ -368,12 +368,12 @@ class ResponseDsl : CommonDsl() {
|
||||
|
||||
fun fromRequest() = FromRequestDsl()
|
||||
|
||||
fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
|
||||
internal fun get(): Response {
|
||||
val response = Response()
|
||||
status?.also { response.status = status}
|
||||
delay?.also { response.delay = delay}
|
||||
status?.also { response.status = status }
|
||||
delay?.also { response.delay = delay }
|
||||
headers?.also { response.headers = headers }
|
||||
cookies?.also { response.cookies = cookies }
|
||||
body?.also { response.body = body }
|
||||
@@ -382,39 +382,39 @@ class ResponseDsl : CommonDsl() {
|
||||
return response
|
||||
}
|
||||
|
||||
private class ResponseHeadersDsl: HeadersDsl() {
|
||||
private class ResponseHeadersDsl : HeadersDsl() {
|
||||
|
||||
private val common = Common()
|
||||
private val common = Common()
|
||||
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when(value) {
|
||||
is String -> return this.common.value(
|
||||
c(value),
|
||||
p(NotToEscapePattern(Pattern.compile(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*")))
|
||||
)
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when (value) {
|
||||
is String -> return this.common.value(
|
||||
c(value),
|
||||
p(NotToEscapePattern(Pattern.compile(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*")))
|
||||
)
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class ResponseCookiesDsl: CookiesDsl() {
|
||||
private class ResponseCookiesDsl : CookiesDsl() {
|
||||
|
||||
private val common = Common()
|
||||
private val common = Common()
|
||||
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when(value) {
|
||||
is String -> return this.common.value(
|
||||
c(value),
|
||||
p(regex(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*"))
|
||||
)
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun matching(value: Any?): Any? {
|
||||
return value?.also {
|
||||
return when (value) {
|
||||
is String -> return this.common.value(
|
||||
c(value),
|
||||
p(regex(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*"))
|
||||
)
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user