-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement Twirp protocol v7 #182
Conversation
* modify mapping in HTTP server * client: generate correct code for 429s from intermediaries
let's preserve the commits when merging this. They're separate changes, but I chose to group them in this PR. |
) { | ||
|
||
def register[T: AsProtoService](svc: T): ServerBuilder = { | ||
val protoService = implicitly[AsProtoService[T]].asProtoService(svc) | ||
this.copy(endpoints = endpoints ++ protoService.rpcs) | ||
} | ||
|
||
def withPrefix(prefix: String): ServerBuilder = { | ||
require(prefix.startsWith("/"), "prefix must start with slash") | ||
require(!prefix.endsWith("/"), "prefix must not end with slash") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move these checks out of this method? Otherwise I can just do ServerBuilder(prefix = "badpath/")
or similar and the validation won't catch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (just one small note) 👍
* add parameter with default value "/twirp" to - ServerBuilder constructor - generated client constructors - generated `MyService.server()` method * breaking change: remove EndpointMetadata.path method the method didn't actually represent the HTTP path anymore, so it didn't make sense.
Upstream Twirp recomends this behaviour to reduce confusion. This is fully backwards-compatible. See-Also: twitchtv/twirp#271
/twirp
HTTP path prefix configurablefixes #181.