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

avoid generating internal frames #589

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address review feedback
  • Loading branch information
fwbrasil committed Aug 22, 2024
commit 7ec3bd5a65889b84499cbedefc5aded6e390b3e4
2 changes: 1 addition & 1 deletion kyo-prelude/shared/src/main/scala/kyo/kernel/Frame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Frame:
s"""Frame cannot be derived within the kyo package: ${sym.owner.fullName}
|
|To resolve this issue:
|1. Propagate the Frame from user code using an implicit parameter.
|1. Propagate the Frame from user code via a `using` parameter.
|2. If absolutely necessary, you can use Frame.internal, but this is not recommended for general use.
|
|Example of propagating Frame:
Expand Down
2 changes: 1 addition & 1 deletion kyo-sttp/js/src/main/scala/kyo/PlatformBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ object PlatformBackend:
val default =
new Backend:
val b = FetchBackend()
def send[A](r: Request[A, Any]) =
def send[A](r: Request[A, Any])(using Frame) =
Fiber.fromFuture(r.send(b)).map(_.get)
end PlatformBackend
4 changes: 2 additions & 2 deletions kyo-sttp/jvm/src/main/scala/kyo/PlatformBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object PlatformBackend:

def apply(backend: SttpBackend[KyoSttpMonad.M, WebSockets])(using Frame): Backend =
new Backend:
def send[A](r: Request[A, Any]) =
def send[A](r: Request[A, Any])(using Frame) =
r.send(backend)

def apply(client: HttpClient)(using Frame): Backend =
Expand All @@ -19,6 +19,6 @@ object PlatformBackend:
val default =
new Backend:
val b = HttpClientKyoBackend()
def send[A](r: Request[A, Any]) =
def send[A](r: Request[A, Any])(using Frame) =
r.send(b)
end PlatformBackend
6 changes: 3 additions & 3 deletions kyo-sttp/shared/src/main/scala/kyo/Requests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ object Requests:
abstract class Backend:
self =>

def send[A](r: Request[A, Any]): Response[A] < Async
def send[A](r: Request[A, Any])(using Frame): Response[A] < Async

def withMeter(m: Meter)(using Frame): Backend =
def withMeter(m: Meter): Backend =
new Backend:
def send[A](r: Request[A, Any]) =
def send[A](r: Request[A, Any])(using Frame) =
m.run(self.send(r))
end Backend

Expand Down
2 changes: 1 addition & 1 deletion kyo-sttp/shared/src/test/scala/kyo/RequestsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class RequestsTest extends Test:

class TestBackend extends Requests.Backend:
var calls = 0
def send[A](r: Request[A, Any]) =
def send[A](r: Request[A, Any])(using Frame) =
calls += 1
Response.ok(Right("mocked")).asInstanceOf[Response[A]]
end TestBackend
Expand Down
Loading