Skip to content

Commit

Permalink
Apply lint
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Apr 29, 2024
1 parent 334b9f4 commit 03e56a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Sources/JetStream/context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ extension JetStreamContext {
return AckFuture(sub: sub, timeout: self.timeout)
}

internal func request<T: Codable>(_ subject: String, message: Data) async throws -> Response<T> {
let response = try await self.client.request(message, subject: "\(self.prefix).\(subject)", timeout: self.timeout)
internal func request<T: Codable>(_ subject: String, message: Data) async throws -> Response<T>
{
let response = try await self.client.request(
message, subject: "\(self.prefix).\(subject)", timeout: self.timeout)

let decoder = JSONDecoder()
// maybe empty is ok if the response type is nil and we can skip this check?
// maybe empty is ok if the response type is nil and we can skip this check?
guard let payload = response.payload else {
throw JetStreamRequestError("empty response payload")
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/JetStream/errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,5 +534,5 @@ public enum Response<T: Codable>: Codable {
}

func test() {
// JetStreamError(code: 400, errorCode: ErrorCode.accountResourcesExceeded, description: nil)
// JetStreamError(code: 400, errorCode: ErrorCode.accountResourcesExceeded, description: nil)
}
4 changes: 2 additions & 2 deletions Tests/JetStreamTests/Integration/JetStreamTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ class JetStreamTests: XCTestCase {
}

XCTAssertEqual(info.streams, 1)
let badInfo: Response<AccountInfo> = try await ctx.request("STREAM.INFO.BAD", message: Data())
let badInfo: Response<AccountInfo> = try await ctx.request(
"STREAM.INFO.BAD", message: Data())
guard case .error(let jetStreamAPIResponse) = badInfo else {
XCTFail("should get error")
return
}

XCTAssertEqual(ErrorCode.streamNotFound, jetStreamAPIResponse.error.errorCode)


}
}

0 comments on commit 03e56a2

Please sign in to comment.