Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@


#if swift(>=3.0)
extension URLRequest {
public var ohhttpStubs_httpBody: Data? {
return (self as NSURLRequest).ohhttpStubs_HTTPBody()
}
}
#else
#if swift(>=2.2)
extension OHHTTPStubs {
Expand Down
9 changes: 9 additions & 0 deletions OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,13 @@ class SwiftHelpersTests : XCTestCase {
XCTAssert((!falseMatcher)(req) == true, "!falseMatcher should result in a trueMatcher")
}
}

#if swift(>=3.0)
func test_ohhttpStubs_httpBody {
var req = URLRequest(url: URL(string: "foo://bar")!)
req.httpBody = Data()

XCTAssert(req.ohhttpStubs_httpBody == req.httpBody)
}
#endif
}