Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k-bx/tonic-web-play
https://github.com/k-bx/tonic-web-play
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/k-bx/tonic-web-play
- Owner: k-bx
- Created: 2023-08-04T06:38:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-04T06:48:26.000Z (over 1 year ago)
- Last Synced: 2024-10-04T15:43:52.999Z (about 1 month ago)
- Language: Rust
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tonic gRPC-Web attempt
## Setup
Add `127.0.0.1 tonic-web-play.localhost` in your /etc/hosts
## Run
**Server**:
```
$ cargo run --bin server
```**Client**:
```
$ cargo run --bin client
```Will run on `http://tonic-web-play.localhost:8301`
## The error
```
➜ tonic-web-play git:(main) ✗ curl --http1.1 -XPOST 'http://tonic-web-play.localhost:8301/ping.Ping/Ping' \
-H 'content-type: application/grpc-web' \
-H 'accept: application/grpc-web+proto' \
--data-raw $'\u0000\u0000\u0000\u0000\u0002\n\u0000' -i
HTTP/1.1 200 OK
content-type: application/grpc-web+proto
grpc-status: 13
grpc-message: Missing%20request%20message.
content-length: 0
date: Fri, 04 Aug 2023 06:31:43 GMT
```The client output:
```
➜ tonic-web-play git:(main) ✗ cargo run --bin client
Compiling tonic-web-play v0.1.0 (/Users/kon/workspace/tonic-web-play)
Finished dev [unoptimized + debuginfo] target(s) in 1.29s
Running `target/debug/client`
BODY=Body(Full(b"\0\0\0\0\x05\n\x03Bob"))
REQUEST=Request { method: POST, uri: http://tonic-web-play.localhost:8301/ping.Ping/Ping, version: HTTP/1.1, headers: {"content-type": "application/grpc-web", "accept": "application/grpc-web"}, body: Body(Full(b"\0\0\0\0\x05\n\x03Bob")) }
REPLY=PingRsp { message: "Hello Bob!" }
```