Comments (3)
Also, when I look at the code, I image that if the cancelling did work, the .fail
handler would be called with a network error, right? Because it doesn't go through the Promise cancellation logic which suppresses the error by default.
Basically in the ResponseHandler.handle
method this sort of check would need to be added I think:
if let error = error as? URLError, error.code == .cancelled {
networkPromise.cancel()
return
}
from malibu.
Update on the cancelAllRequests
problem I am seeing: because self.queue.addOperation(operation)
is itself done within an async operation (namely the middlewarePromise
), by the time cancelAllRequests
is executed, the queue is still empty. Only after cancelAllRequests
is run on the empty queue, is the operation actually added to the queue. This seems like a problem to me :)
Added some logging within cancelAllRequests
and execute
..
cancelAllRequests - number of operations: 0
addOperation - number of operations: 1
from malibu.
I think you're right about cancelAllRequests
being called when the queue is still empty. I'm not sure how to fix it in a good way though. One option could be to store network promises in array and then iterate through it and cancel in cancelAllRequests
function.
from malibu.
Related Issues (20)
- Unable to change response code when mocking with JSON HOT 1
- validate() does not consider 304 a valid response HOT 1
- MockProvider does not call promise's callback HOT 4
- ETag still present even after calling Malibu.clearStorage() HOT 11
- Documentation Error for Pre-processing HOT 1
- Reject promise in middleware HOT 5
- Testing multi-request flows and MockProvider HOT 2
- Make `preProcessRequest` return a promise (or give middleware access to the Request) HOT 1
- New pod release? HOT 1
- Idea/suggestion: improve and extend Codable support HOT 1
- Retry with backoff HOT 2
- Proposal: Adding `RequestBehaviour`s to Malibu HOT 7
- Networking class doesn't work HOT 2
- Can't run playground
- Why there is a dependency on a small barely supported library (When)? HOT 1
- Response serialization
- SSL Pinning HOT 1
- Malibu including 'When' in `Malibu.framework/Frameworks` folder HOT 1
- Increased number of errors after updating to 6.3.0+ HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from malibu.