Skip to content

Commit

Permalink
Add leading slash to generated RPC paths
Browse files Browse the repository at this point in the history
This updates generated RPC paths to include leading slashes, which is in line with what `connect-go` does.

It also resolves issues with adding path components to the `host` flagged in #161.
  • Loading branch information
rebello95 committed Sep 7, 2023
1 parent 21a0c08 commit 4276ace
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ internal final class Connectrpc_Eliza_V1_ElizaServiceClient: Connectrpc_Eliza_V1

@available(iOS 13, *)
internal func `say`(request: Connectrpc_Eliza_V1_SayRequest, headers: Connect.Headers = [:]) async -> ResponseMessage<Connectrpc_Eliza_V1_SayResponse> {
return await self.client.unary(path: "connectrpc.eliza.v1.ElizaService/Say", request: request, headers: headers)
return await self.client.unary(path: "/connectrpc.eliza.v1.ElizaService/Say", request: request, headers: headers)
}

@available(iOS 13, *)
internal func `converse`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface<Connectrpc_Eliza_V1_ConverseRequest, Connectrpc_Eliza_V1_ConverseResponse> {
return self.client.bidirectionalStream(path: "connectrpc.eliza.v1.ElizaService/Converse", headers: headers)
return self.client.bidirectionalStream(path: "/connectrpc.eliza.v1.ElizaService/Converse", headers: headers)
}

@available(iOS 13, *)
internal func `introduce`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface<Connectrpc_Eliza_V1_IntroduceRequest, Connectrpc_Eliza_V1_IntroduceResponse> {
return self.client.serverOnlyStream(path: "connectrpc.eliza.v1.ElizaService/Introduce", headers: headers)
return self.client.serverOnlyStream(path: "/connectrpc.eliza.v1.ElizaService/Introduce", headers: headers)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SwiftProtobufPluginLibrary

extension MethodDescriptor {
public var methodPath: String {
return "\(self.service.servicePath)/\(self.name)"
return "/\(self.service.servicePath)/\(self.name)"
}

public func name(using options: GeneratorOptions) -> String {
Expand Down
Loading

0 comments on commit 4276ace

Please sign in to comment.