Class CorsUtils


  • public final class CorsUtils
    extends java.lang.Object
    Utility class to do CORS related assertions.
    Since:
    3.9.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response, java.lang.String origin, io.micronaut.http.HttpMethod method)  
      static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response, java.lang.String origin, io.micronaut.http.HttpMethod method, boolean allowCredentials)  
      static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response, java.lang.String origin, io.micronaut.http.HttpMethod method, java.lang.String maxAge)  
      static void assertCorsHeadersNotPresent​(io.micronaut.http.HttpResponse<?> response)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • assertCorsHeadersNotPresent

        public static void assertCorsHeadersNotPresent​(io.micronaut.http.HttpResponse<?> response)
        Parameters:
        response - HTTP Response to run CORS assertions against it.
      • assertCorsHeaders

        public static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response,
                                             java.lang.String origin,
                                             io.micronaut.http.HttpMethod method)
        Parameters:
        response - HTTP Response to run CORS assertions against it.
        origin - The expected value for the HTTP Header "Access-Control-Allow-Origin".
        method - The expected value for the HTTP Header "Access-Control-Allow-Methods".
      • assertCorsHeaders

        public static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response,
                                             java.lang.String origin,
                                             io.micronaut.http.HttpMethod method,
                                             boolean allowCredentials)
        Parameters:
        response - HTTP Response to run CORS assertions against it.
        origin - The expected value for the HTTP Header "Access-Control-Allow-Origin".
        method - The expected value for the HTTP Header "Access-Control-Allow-Methods".
        allowCredentials - The expected value for the HTTP Header "Access-Control-Allow-Credentials".
      • assertCorsHeaders

        public static void assertCorsHeaders​(io.micronaut.http.HttpResponse<?> response,
                                             java.lang.String origin,
                                             io.micronaut.http.HttpMethod method,
                                             java.lang.String maxAge)
        Parameters:
        response - HTTP Response to run CORS assertions against it.
        origin - The expected value for the HTTP Header "Access-Control-Allow-Origin".
        method - The expected value for the HTTP Header "Access-Control-Allow-Methods".
        maxAge - The expected value for the HTTP Header "Access-Control-Max-Age".