Comments (3)
👍 I realize that this issue is super old, but I would appreciate this feature :)
from nocilla.
Hi,
It's not documented but Nocilla is pretty extensible. In the DSL, both the expected URL and the expected body, expect an LSMatcheable
.
All you have to do is create an object that conforms to that protocol and has the logic that you wish to implement and pass that object to the DSL. For instance you could do:
stubRequest(@"GET", matchingUrl(@"http://foo.com").withQuery(@{"abc": @"123"}))
.withBody(matchingJson(@{"fgh":@"666"))
Your functions matchingUrl().withQuery()
and matchingJson()
should return an LSMatcheable
And LSMatcheable
spits LSMatcher
s that can compare in arbitrary ways the actual string (url, body, anything) with whatever data you passed into the DSL. That comparison could be order agnostic if you wish.
Nocilla is internally implemented using LSMatcheable
, that's how I added support for regular expressions in URL, so you'll have examples of usage in the code already.
Play with it, let me know if you have any questions and contribute back if you feel like it.
from nocilla.
Thanks @luisobo. I think I'll look into this!
from nocilla.
Related Issues (20)
- Not able to stub cookies for normal (non-directed requests) HOT 1
- Body matcher fails to match arbitrary NSData
- Support for RestKit HOT 1
- Add 0.10.0 to CocoaPods.org HOT 1
- Synchronous Request Support
- Wait for async request to complete before stop() HOT 1
- Crash in LSHTTPStubURLProtocol - EXC_BAD_ACCESS - Specific way to stub redirects? HOT 1
- Ability to Delay a Response HOT 1
- Redirect Implementation is Inconsistent With OS Behavior
- Carthage Binaries HOT 1
- ASIHTTPRequest synchronous request with stub never ends HOT 1
- LSNocilla.sharedInstance().stop() Not working HOT 5
- Project no longer maintained? HOT 3
- Nocilla never returns the stub HOT 2
- App store rejection due to private api references HOT 3
- Use this snippet to stub the request HOT 1
- Push v0.11.0 podspec to Cocoapods HOT 2
- Swift 3 Support HOT 2
- How do I Nocilla in Swift 3? HOT 2
- SPM Support
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 nocilla.