Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSC8b #432

Merged
merged 1 commit into from
Apr 28, 2016
Merged

RSC8b #432

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
32 changes: 32 additions & 0 deletions Spec/RestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,38 @@ class RestClient: QuickSpec {

}

// RSC8b
it("should use JSON text protocol") {
let options = AblyTests.commonAppSetup()
expect(options.useBinaryProtocol).to(beFalse())

let rest = ARTRest(options: options)
rest.httpExecutor = testHTTPExecutor
waitUntil(timeout: testTimeout) { done in
rest.channels.get("test").publish(nil, data: "message") { error in
done()
}
}

switch extractBodyAsJSON(testHTTPExecutor.requests.first) {
case .Failure(let error):
fail(error)
default: break
}

let realtime = AblyTests.newRealtime(options)
defer { realtime.close() }
waitUntil(timeout: testTimeout) { done in
realtime.channels.get("test").publish(nil, data: "message") { error in
done()
}
}

let transport = realtime.transport as! TestProxyTransport
let object = try! NSJSONSerialization.JSONObjectWithData(transport.rawDataSent.first!, options: NSJSONReadingOptions(rawValue: 0))
expect(NSJSONSerialization.isValidJSONObject(object)).to(beTrue())
}

} //RestClient
}
}