A command line utility to talk to a tchannel server
tcurl -p host:port <service> <endpoint> [options]
Options:
-2 [data] send an arg2 blob
-3 [data] send an arg3 blob
--depth=n configure inspect printing depth
-j print JSON
-J [indent] print JSON with indentation
-t [dir] directory containing Thrift files
npm install tcurl
For the purposes of these examples, let's assume that you have a TChannel
server listening on localhost:1234. The server registers handlers for the
thrift interface saved as services/chamber.thrift and defined as:
struct EchoRequest {
1: required string input;
}
service Chamber {
string echo(
1: required EchoRequest request;
)
}You could use TCurl to query this service by running:
`tcurl -p localhost:1234 chamber Chamber::echo -t ./services -3 '{"request": {"input": "foo"}}'
For TChannel and Hyperbahn to work together effectively, most tchannel services need to listen on the external IP of the host they are running on.
This means when you use 127.0.0.1 you cannot reach the service with tcurl as it's not listening on
loopback.
To make supporting external IPs easier we've made localhost resolve to the external IP of the machine.
This means if your listening on loopback you have to use 127.0.0.1 and not localhost
npm run add-licenceThis will add the licence headers.npm run coverThis runs the tests with code coveragenpm run lintThis will run the linter on your codenpm testThis will run the tests.npm run traceThis will run your tests in tracing mode.npm run travisThis is run by travis.CI to run your testsnpm run view-coverThis will show code coverage in a browser
- Raynos
- ShanniLi