Skip to content

OHHTTPStubs not working with watchOS #287

@tfonfara

Description

@tfonfara

New Issue Checklist

Environment

  • version of OHHTTPStubs: 6.1.0
  • integration method you are using:
    • Cocoapods
    • Carthage
    • submodule
    • other
  • version of the tool you use: 1.5.3

Issue Description

Stubs are never considered for watchOS, same code runs fine in iOS.

Steps to reproduce

  1. Create an iOS + watchOS application
  2. Add the following code in both apps, this should return empty data for all requests:
stub(condition: isScheme("http") || isScheme("https")) { _ in
    return OHHTTPStubsResponse(data: Data(), statusCode: 200, headers: nil)
}
  1. Add code to download any file and print contents

Expectation: Output should be empty in both apps (as the stubs are returning an empty data object)
Results iOS: Empty output is printed
Results watchOS: Actual file contents are printed, download was not stubbed

Can also be veryfied using breakpoints, for watchOS the return statement is never being called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions