Source:
<code>public void testCorsPreflightNegative() throws Exception { HttpOptions request = new HttpOptions(presignedGET); CloseableHttpResponse response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) <START> .isEqualTo(HttpStatus.SC_FORBIDDEN); <END> request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_0>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "PATCH"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Accept-Encoding"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Accept, Accept-Encoding"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); }</code><technical_language>running s3-tests ./virtualenv/bin/nosetests -a 'cors', I errors of form: Traceback (most call last): File "/home/gaul/work/s3proxy/s3-tests/virtualenv/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/gaul/work/s3proxy/s3-tests/s3tests/functional/test_s3.py", line 6125, in test_cors_header_option eq(e.status, 404) AssertionError: 403 != 404 I lack background in CORS is this correct error code</technical_language>

Target:
public void testCorsPreflightNegative() throws Exception { HttpOptions request = new HttpOptions(presignedGET); HttpResponse response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_0>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "PATCH"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Accept-Encoding"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); request.reset(); request.setHeader(HttpHeaders.ORIGIN, "<LINK_1>"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); request.setHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Accept, Accept-Encoding"); response = httpClient.execute(request); assertThat(response.getStatusLine().getStatusCode()) .isEqualTo(HttpStatus.SC_FORBIDDEN); }