Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUNIT: Migrate assets dispatcher test to Kotlin #1341

Merged
merged 7 commits into from
Dec 7, 2023

Conversation

MOOOOOSER
Copy link
Contributor

No description provided.

Comment on lines 19 to 21
// Setting the "Origin: header" must be allowed by -Dsun.net.http.allowRestrictedHeaders=true
HttpURLConnection c = new URL("http://localhost:9999/system/ok").openConnection()
c.addRequestProperty("Origin", "TEST")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Setting the "Origin: header" must be allowed by -Dsun.net.http.allowRestrictedHeaders=true
HttpURLConnection c = new URL("http://localhost:9999/system/ok").openConnection()
c.addRequestProperty("Origin", "TEST")
HttpURLConnection c = new URL("http://localhost:9999/system/ok").openConnection()
// Setting the "Origin" header must be allowed by system property sun.net.http.allowRestrictedHeaders=true
c.addRequestProperty("Origin", "TEST")

@@ -16,8 +16,7 @@ class CORSSpec extends BaseSpecification {

def "expect 'Access-Control-Allow-Origin' for requests with 'origin'"() {
when:
// Allow us to set the Origin: header...
System.setProperty("sun.net.http.allowRestrictedHeaders", "true")
// Setting the "Origin: header" must be allowed by -Dsun.net.http.allowRestrictedHeaders=true
HttpURLConnection c = new URL("http://localhost:9999/system/ok").openConnection()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Rename c to connection

fun `proper caching set for all kind of assets and cache-control URIs`(uri: String, header: String) {
val connection = URL("http://localhost:9999" + uri).openConnection()
assertEquals(header, connection.getHeaderField(HttpHeaderNames.CACHE_CONTROL.toString()))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Remove empty line

@MOOOOOSER MOOOOOSER merged commit 647101c into develop Dec 7, 2023
@jakobvogel jakobvogel deleted the feature/smo/migrate-assets-dispatcher branch December 20, 2023 12:03
@sabieber sabieber added the 🛠️ Maintenance Translations, Code Cleanup, ... label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ Maintenance Translations, Code Cleanup, ...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants