I'm trying to stub my Google Places calls using a local json
file. Using Charles proxy, I find that the Google Maps SDK uses the url https://www.googleapis.com
. So, I try to stub like:
stub(isHost("https://www.googleapis.com")) { request in
OHHTTPStubsResponse(fileAtPath: "google_maps.json", statusCode: 200, headers: ["Content-Type":"application/json"])
}
But it's not intercepting the google maps SDK calls. Any ideas? Could this be the Google Maps SDK using something other than Cocoa's URL Loading System?
Answer given here: (I was using the incorrect host name, should use simply "www.googleapis.com")
https://github.com/AliSoftware/OHHTTPStubs/issues/219