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

How to mock text/event-stream responses #162

Open
grdsdev opened this issue Jan 21, 2025 · 0 comments
Open

How to mock text/event-stream responses #162

grdsdev opened this issue Jan 21, 2025 · 0 comments

Comments

@grdsdev
Copy link

grdsdev commented Jan 21, 2025

Hi, thanks for awesome library.

I wonder if there is any way to mock text/event-stream responses? Wasn't able to find any in docs.

As I don't think it is possible in the current state of the lib, may I suggest feature.

Would cool to be able to produce multiple Data responses for this case, API example:

Mock(
  url: URL(string: "http://localhost:54321/functions/v1/stream")!,
  statusCode: 200,
  data: [
    .get: { continuation in 
      continuation.yield(Data("hello".utf8))
      continuation.yield(Data("world".utf8))
      continuation.finish()
    }
  ]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant