Package io.micronaut.http.server.tck
Class CorsUtils
java.lang.Object
io.micronaut.http.server.tck.CorsUtils
Utility class to do CORS related assertions.
- Since:
- 3.9.0
- Author:
- Sergio del Amo
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertCorsHeaders
(HttpResponse<?> response, String origin, HttpMethod method) static void
assertCorsHeaders
(HttpResponse<?> response, String origin, HttpMethod method, boolean allowCredentials) static void
assertCorsHeaders
(HttpResponse<?> response, String origin, HttpMethod method, boolean allowCredentials, boolean allowPrivateNetwork) static void
assertCorsHeaders
(HttpResponse<?> response, String origin, HttpMethod method, String maxAge) static void
assertCorsHeadersNotPresent
(HttpResponse<?> response)
-
Method Details
-
assertCorsHeadersNotPresent
- Parameters:
response
- HTTP Response to run CORS assertions against it.
-
assertCorsHeaders
- 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(HttpResponse<?> response, String origin, 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(HttpResponse<?> response, String origin, 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(HttpResponse<?> response, String origin, 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".
-