-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
186 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
coverage-report/src/test/java/org/jooby/issues/Issue468.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.jooby.issues; | ||
|
||
import org.jooby.FlashScope; | ||
import org.jooby.Results; | ||
import org.jooby.test.ServerFeature; | ||
import org.junit.Test; | ||
|
||
import com.typesafe.config.ConfigFactory; | ||
import com.typesafe.config.ConfigValueFactory; | ||
|
||
public class Issue468 extends ServerFeature { | ||
|
||
{ | ||
use(ConfigFactory.empty() | ||
.withValue("application.path", ConfigValueFactory.fromAnyRef("/468"))); | ||
|
||
use(new FlashScope()); | ||
|
||
get("/", req -> req.flash().get("foo")); | ||
|
||
get("/redirect", req -> { | ||
req.flash("foo", "bar"); | ||
return Results.redirect(req.contextPath() + "/"); | ||
}); | ||
} | ||
|
||
@Test | ||
public void flashAttributeIsPresentBetweenDiffPaths() throws Exception { | ||
request() | ||
.dontFollowRedirect() | ||
.get("/468/redirect") | ||
.execute() | ||
.header("Set-Cookie", "jooby.flash=foo=bar;Version=1;Path=/468;HttpOnly"); | ||
} | ||
|
||
@Test | ||
public void flashAttributeIsPresentBetweenDiffPathsOnRedirect() throws Exception { | ||
request() | ||
.get("/468/redirect") | ||
.expect("bar"); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
coverage-report/src/test/java/org/jooby/issues/Issue468a.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.jooby.issues; | ||
|
||
import org.jooby.Cookie; | ||
import org.jooby.FlashScope; | ||
import org.jooby.Results; | ||
import org.jooby.test.ServerFeature; | ||
import org.junit.Test; | ||
|
||
public class Issue468a extends ServerFeature { | ||
|
||
{ | ||
use(new FlashScope(new Cookie.Definition("x").httpOnly(false))); | ||
|
||
get("/468", req -> { | ||
req.flash("foo", "bar"); | ||
return Results.redirect(req.contextPath() + "/"); | ||
}); | ||
} | ||
|
||
@Test | ||
public void flashAttributeIsPresentBetweenDiffPaths() throws Exception { | ||
request() | ||
.dontFollowRedirect() | ||
.get("/468") | ||
.execute() | ||
.header("Set-Cookie", "x=foo=bar;Version=1;Path=/"); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
coverage-report/src/test/java/org/jooby/issues/Issue468b.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.jooby.issues; | ||
|
||
import org.jooby.FlashScope; | ||
import org.jooby.Results; | ||
import org.jooby.test.ServerFeature; | ||
import org.junit.Test; | ||
|
||
public class Issue468b extends ServerFeature { | ||
|
||
{ | ||
use(new FlashScope()); | ||
|
||
get("/468", req -> req.flash().get("foo")); | ||
|
||
get("/468/redirect", req -> { | ||
req.flash("foo", "bar"); | ||
return Results.redirect("/468"); | ||
}); | ||
} | ||
|
||
@Test | ||
public void flashAttributeIsPresentBetweenDiffPaths() throws Exception { | ||
request() | ||
.dontFollowRedirect() | ||
.get("/468/redirect") | ||
.execute() | ||
.header("Set-Cookie", "jooby.flash=foo=bar;Version=1;Path=/;HttpOnly"); | ||
} | ||
|
||
@Test | ||
public void flashAttributeIsPresentBetweenDiffPathsOnRedirect() throws Exception { | ||
request() | ||
.get("/468/redirect") | ||
.expect("bar"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters