Skip to content

Commit ea15ba3

Browse files
committed
Fix refresh route
1 parent 7299705 commit ea15ba3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

project/src/routes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def routes[F[_]: Files: MonadThrow](
204204
Router(spaRoute -> r)
205205

206206
val refreshRoutes = HttpRoutes.of[IO] {
207-
case GET -> Root / "api" / "v1" / "sse" =>
207+
case GET -> Root / "refresh" / "v1" / "sse" =>
208208
val keepAlive = fs2.Stream.fixedRate[IO](10.seconds).as(KeepAlive())
209209
Ok(
210210
keepAlive

project/test/src/liveServer.test.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import org.http4s.Method
1818
import org.http4s.Uri
1919
import scalatags.Text.styles
2020

21+
import scala.concurrent.duration.*
22+
2123
/*
2224
Run
2325
cs launch com.microsoft.playwright:playwright:1.41.1 -M "com.microsoft.playwright.CLI" -- install --with-deps
@@ -130,13 +132,13 @@ trait PlaywrightTest extends CatsEffectSuite:
130132
)
131133
LiveServer.main(lsc).map((_, dir, lsc.port))
132134
}
133-
}.test("incremental") {
135+
}.test("incremental".only) {
134136
(_, testDir, port) =>
135137
val increaseTimeout = ContainsTextOptions()
136138
increaseTimeout.setTimeout(15000)
137-
138-
IO(page.navigate(s"http://localhost:$port")) >>
139-
IO(assertThat(page.locator("h1")).containsText("HelloWorld", increaseTimeout)) >>
139+
IO.sleep(3.seconds) >>
140+
IO(page.navigate(s"http://localhost:$port")) >>
141+
IO(assertThat(page.locator("h1")).containsText("HelloWorld", increaseTimeout)) >>
140142
IO.blocking(os.write.over(testDir / "hello.scala", helloWorldCode("Bye"))) >>
141143
IO(assertThat(page.locator("h1")).containsText("ByeWorld", increaseTimeout)) >>
142144
IO.blocking(os.write.append(styleDir(testDir) / "index.less", "h1 { color: red; }")) >>

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ You'll need to make sure it includes this script. Otherwise no reload on change.
147147

148148
```html
149149
<script>
150-
const sse = new EventSource("/api/v1/sse");
150+
const sse = new EventSource("/refresh/v1/sse");
151151
sse.addEventListener("message", (e) => {
152152
const msg = JSON.parse(e.data);
153153

0 commit comments

Comments
 (0)