io.codearte.accurest.dsl.internal.Headers.groovy Maven / Gradle / Ivy
package io.codearte.accurest.dsl.internal
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import groovy.transform.TypeChecked
@EqualsAndHashCode(includeFields = true)
@ToString(includePackage = false, includeFields = true, ignoreNulls = true, includeNames = true)
@TypeChecked
class Headers {
Set entries = []
void header(Map singleHeader) {
Map.Entry first = singleHeader.entrySet().first()
entries << new Header(first?.key, first?.value)
}
void header(String headerKey, Object headerValue) {
entries << new Header(headerKey, headerValue)
}
void collect(Closure closure) {
entries?.each {
header -> closure(header)
}
}
Map asStubSideMap() {
def acc = [:].withDefault { [] as Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy