webstub 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/webstub/patch/session_configuration.rb +10 -6
- data/lib/webstub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a0647b249466d2189e9ebf25a250591112b85b
|
4
|
+
data.tar.gz: 919be82dac97c1de010be6ec29d29272991c1a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec623ef6875c97b66c376786436be175110e7dad8f5294d6756edbda3f6fabf1fe71d916f4aaa1a23730642072258d45728f175b221930c30299e65badb20145
|
7
|
+
data.tar.gz: 0a109dab7b355c1d46ef2d288d6f024ef6a6af7d433ce0ec0eae1c11f16b051f2181dab6deb879b33c7aee10d5138fe2cea52a4654faa2c63a9f0f07eac3aa58
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ What if [WebMock](https://github.com/bblimke/webmock) and [NSURLProtocol](https:
|
|
5
5
|
|
6
6
|
Features
|
7
7
|
------------
|
8
|
-
* Supports most any HTTP library that is built on NSURLConnection
|
8
|
+
* Supports most any HTTP library that is built on NSURLConnection / NSURLSession
|
9
9
|
* Request matching based upon HTTP method, URI, and body
|
10
10
|
* Optionally, disable real network access
|
11
11
|
* Familiar, delicious syntax
|
@@ -149,6 +149,10 @@ describe Elevate::HTTP do
|
|
149
149
|
end
|
150
150
|
```
|
151
151
|
|
152
|
+
Caveats
|
153
|
+
---------
|
154
|
+
While WebStub supports `NSURLSession`, it does not support background sessions, as they don't allow the use of custom `NSURLProtocol` classes.
|
155
|
+
|
152
156
|
TODO
|
153
157
|
---------
|
154
158
|
* Handle query params similarly to form data
|
@@ -3,11 +3,13 @@ if Kernel.const_defined?(:NSURLSessionConfiguration)
|
|
3
3
|
class << self
|
4
4
|
alias_method :originalDefaultSessionConfiguration, :defaultSessionConfiguration
|
5
5
|
|
6
|
-
def
|
6
|
+
def defaultSessionConfiguration
|
7
7
|
config = originalDefaultSessionConfiguration
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
protocols = config.protocolClasses || []
|
10
|
+
unless protocols.include?(WebStub::Protocol)
|
11
|
+
protocols << WebStub::Protocol
|
12
|
+
config.protocolClasses = protocols
|
11
13
|
end
|
12
14
|
|
13
15
|
config
|
@@ -15,11 +17,13 @@ if Kernel.const_defined?(:NSURLSessionConfiguration)
|
|
15
17
|
|
16
18
|
alias_method :originalEphemeralSessionConfiguration, :ephemeralSessionConfiguration
|
17
19
|
|
18
|
-
def
|
20
|
+
def ephemeralSessionConfiguration
|
19
21
|
config = originalEphemeralSessionConfiguration
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
protocols = config.protocolClasses || []
|
24
|
+
unless protocols.include?(WebStub::Protocol)
|
25
|
+
protocols << WebStub::Protocol
|
26
|
+
config.protocolClasses = protocols
|
23
27
|
end
|
24
28
|
|
25
29
|
config
|
data/lib/webstub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webstub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Green
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|