Class CorsUtils

java.lang.Object
io.micronaut.http.server.tck.CorsUtils

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

    • 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, 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, 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, String origin, io.micronaut.http.HttpMethod method, boolean allowCredentials, boolean allowPrivateNetwork)
      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".
      allowPrivateNetwork - The expected value for the HTTP Header "Access-Control-Allow-Private-Network".
    • assertCorsHeaders

      public static void assertCorsHeaders(io.micronaut.http.HttpResponse<?> response, String origin, io.micronaut.http.HttpMethod method, 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".