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

FEATURE REQUEST: Ability to control response stream #362

Open
6 of 9 tasks
Tyler-Keith-Thompson opened this issue Jul 17, 2023 · 0 comments
Open
6 of 9 tasks

FEATURE REQUEST: Ability to control response stream #362

Tyler-Keith-Thompson opened this issue Jul 17, 2023 · 0 comments

Comments

@Tyler-Keith-Thompson
Copy link

Tyler-Keith-Thompson commented Jul 17, 2023

New Issue Checklist

Environment

  • version of OHHTTPStubs: 9.1.0
  • integration method you are using:
    • Cocoapods
    • Carthage
    • submodule
    • other Swift Package Manager
  • version of the tool you use: Uhh....package tools version 5.6

Issue Description

I am attempting to use this to test a Server-Sent Events implementation. That particular protocol likes to send data in chunks of varying sizes as it streams, example:

id: 1
data: This

data:  is

data:  a

data:  sentence

data: .

OHHTTPStubs at the moment doesn't seem to expose a way to send partial responses back as part of the stream. Specifically, what I need is the URLSessionDataDelegate to have its urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) method called with each sent event.

An ideal solution in my mind would be to allow me to pass an array of Data to the response and have it work out the rest, but honestly I'd be up for anything that worked.

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