All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.codecentric.hikaku.converters.spring.extensions.HttpMethodsSpringExtension.kt Maven / Gradle / Ivy

Go to download

A library that tests if the implementation of a REST-API meets its specification. This module contains a converter for spring-mvc implementations.

There is a newer version: 3.3.0
Show newest version
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