Skip to content

Commit

Permalink
website: add docs for inconsistent URL path issue (#262)
Browse files Browse the repository at this point in the history
* website: add docs for inconsistent URL path issue

* move url paths docs to routing.md
  • Loading branch information
dpolansky authored Aug 20, 2020
1 parent d0e66ee commit 987a500
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ the route would be:
POST /twirp/twirp.example.haberdasher.Haberdasher/MakeHat
```

Note that the [official Go implementation](https://github.com/twitchtv/twirp) differs in behavior from what is described in the [specification](https://twitchtv.github.io/twirp/docs/spec_v5.html). It modifies the service and method names to be CamelCase (with an initial capital) instead of using the exact names specified in the protobuf definition. This means that the URL paths generated for Go clients and servers may differ from paths generated for other language implementations. This issue is discussed in [#244](https://github.com/twitchtv/twirp/issues/244).

For instance, if the `MakeHat` method name was spelled as `make_hat`, the Go implementation would generate this route:
```
/twirp/twirp.example.haberdasher.Haberdasher/MakeHat
```
instead of what the spec says the route should be:
```
/twirp/twirp.example.haberdasher.Haberdasher/make_hat
```

If having consistent URL paths across language implementations is required, it is recommended to follow the [Protocol Buffers Style Guide](https://developers.google.com/protocol-buffers/docs/style#services) for method and service names by CamelCasing them. This ensures that the URL paths generated by Twirp are consistent across language implementations.

### Content-Type Header (json or protobuf)

The `Content-Type` header is required and must be either `application/json` or
Expand Down

0 comments on commit 987a500

Please sign in to comment.