-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Hi, I've noticed that SBTProxyURLProtocol.startLoading
returns the response for the subbed request in the main thread:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(stubbingResponseTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
....
}
Can we use dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
or any other queue that's not the main thread instead (or at least allow customization)? There are scenarios in my suite where I mock HW by using mocks within the main target whose values are customized from a UI-Test. For this, I use dummy http requests. The mocked functions can be async or sync. In order for the sync methods to work I need to block the main thread. However the test hangs indefinitely because the main thread is blocked and SBTProxyURLProtocol
tries to return the data into the main
queue.
I don't think the change I suggest breaks anything and I think is more accurate as you'd expect the response to come from a background thread instead of the main thread.