borchero / Squid

Declarative and Reactive Networking for Swift.

Home Page:https://squid.borchero.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mock requests for testing

jessegrosjean opened this issue · comments

I'm trying to Mock endpoints with Squid and Mocker.

Here's the basic pattern of what I think I want to do:

import Mocker
import Squid

extension HttpService {
    func mock<R>(request: R, statusCode: Int = 200, data: [Mock.HTTPMethod : Data]) where R: Request {
        Mock(url: ..., dataType: .json, statusCode: statusCode, data: data)
    }
}

The problem I'm not sure how to generate a final URL from a Squid Request and Squid HttpService. I know it does this internally, but I can't figure how to to make it generate the URL myself. Is there some method that I'm overlooking? Or is this something that could be added?