diff --git a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/PlainHttpIT.kt b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/PlainHttpIT.kt index fe6a87a86..72c4f50b4 100644 --- a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/PlainHttpIT.kt +++ b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/PlainHttpIT.kt @@ -176,19 +176,23 @@ internal class PlainHttpIT : S3TestBase() { @Test fun testCorsHeaders(testInfo: TestInfo) { val targetBucket = givenBucketV2(testInfo) - val httpOptions = HttpOptions("$serviceEndpoint/$targetBucket").apply { - this.setHeader(BasicHeader("Origin", "http://someurl.com")) - this.setHeader(BasicHeader("Access-Control-Request-Method", "GET")) - this.setHeader(BasicHeader("Access-Control-Request-Headers", "Content-Type, x-requested-with")) - } - httpClient.execute(httpOptions).use { - assertThat(it.getFirstHeader("Access-Control-Allow-Origin").value).isEqualTo("http://someurl.com") - assertThat(it.getFirstHeader("Access-Control-Allow-Methods").value).isEqualTo("GET") - assertThat(it.getFirstHeader("Access-Control-Allow-Headers").value) - .isEqualTo("Content-Type, x-requested-with") - assertThat(it.getFirstHeader("Access-Control-Allow-Credentials").value).isEqualTo("true") - assertThat(it.getFirstHeader("Allow").value).contains("GET") + arrayOf("GET", "PUT").forEach { method -> + val httpOptions = HttpOptions("$serviceEndpoint/$targetBucket").apply { + this.setHeader(BasicHeader("Origin", "http://someurl.com")) + this.setHeader(BasicHeader("Access-Control-Request-Method", method)) + this.setHeader(BasicHeader("Access-Control-Request-Headers", "Content-Type, x-requested-with")) + } + + httpClient.execute(httpOptions).use { + assertThat(it.statusLine.statusCode).isEqualTo(HttpStatus.SC_OK) + assertThat(it.getFirstHeader("Access-Control-Allow-Origin").value).isEqualTo("http://someurl.com") + assertThat(it.getFirstHeader("Access-Control-Allow-Methods").value).isEqualTo(method) + assertThat(it.getFirstHeader("Access-Control-Allow-Headers").value) + .isEqualTo("Content-Type, x-requested-with") + assertThat(it.getFirstHeader("Access-Control-Allow-Credentials").value).isEqualTo("true") + assertThat(it.getFirstHeader("Allow").value).contains(method) + } } }