de.codecentric.hikaku.converters.spring.extensions.HttpMethodsSpringExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hikaku-spring Show documentation
Show all versions of hikaku-spring Show documentation
A library that tests if the implementation of a REST-API meets its specification. This module contains a converter for spring-mvc implementations.
package de.codecentric.hikaku.converters.spring.extensions
import de.codecentric.hikaku.endpoints.HttpMethod
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.servlet.mvc.method.RequestMappingInfo
internal fun RequestMappingInfo.hikakuHttpMethods(): Set {
return this.methodsCondition.methods
.map {
when (it) {
RequestMethod.GET -> HttpMethod.GET
RequestMethod.POST -> HttpMethod.POST
RequestMethod.HEAD -> HttpMethod.HEAD
RequestMethod.PUT -> HttpMethod.PUT
RequestMethod.PATCH -> HttpMethod.PATCH
RequestMethod.DELETE -> HttpMethod.DELETE
RequestMethod.TRACE -> HttpMethod.TRACE
RequestMethod.OPTIONS -> HttpMethod.OPTIONS
null -> HttpMethod.OPTIONS
}
}
.toSet()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy