https://github.com/michaelhenry/hijackr
An Easy to use response mocker to your URLRequest for Unit/UITesting!
https://github.com/michaelhenry/hijackr
Last synced: 4 months ago
JSON representation
An Easy to use response mocker to your URLRequest for Unit/UITesting!
- Host: GitHub
- URL: https://github.com/michaelhenry/hijackr
- Owner: michaelhenry
- License: mit
- Created: 2019-08-29T16:40:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-06T07:37:47.000Z (over 6 years ago)
- Last Synced: 2025-03-01T20:23:51.023Z (10 months ago)
- Language: Swift
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hijackr🛩
[](https://travis-ci.org/michaelhenry/Hijackr)
[](https://cocoapods.org/pods/Hijackr)
[](https://cocoapods.org/pods/Hijackr)
[](https://cocoapods.org/pods/Hijackr)
## Installation
Hijackr is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'Hijackr'
```
## How to Use
To register:
```swift
Hijackr.register()
```
To unregister:
```swift
Hijackr.unregister()
```
To hijack a request:
```swift
Hijackr.hijack(request: request, with: response)
```
Example:
```swift
let request = URLRequest(url: URL(string: "https://www.google.com")!)
let response = Hijackr.Response(statusCode: 200, body: "hello".data(using: .utf8))
Hijackr.hijack(request: request, with: response)
```
## UnitTest
Test Cases can be found [here](/Example/Tests/)
## Author
michaelhenry, me@iamkel.net
## License
Hijackr is available under the MIT license. See the LICENSE file for more info.