Skip to content

why using curl as client can not call hello function in example-service server #488

Answered by tikue
tomarock asked this question in Q&A
Discussion options

You must be logged in to vote

Ah ok, try using RUST_LOG=debug to get more verbose logging. But I think the problem is that the curl command you used sends an HTTP request that looks like this:

POST / HTTP/1.1
Host: localhost:8888
User-Agent: curl/8.7.1
Accept: */*
Content-Type: application/json
Content-Length: 63

{"jsonrpc":"2.0","method":"hello","params":["YourName"],"id":1}

But the server binary in example-service does not use HTTP at all. The request you need to send looks something like this:

{"Request":{"context":{"deadline":{"secs":9,"nanos":999699542},"trace_context":{"trace_id":[8,170,113,216,215,155,43,44,255,165,13,120,158,242,13,97],"span_id":7845148348690344672,"sampling_decision":"Unampled"}},"id":0,"me…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tomarock
Comment options

@tikue
Comment options

tikue Nov 2, 2024
Maintainer

Answer selected by tomarock
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
2 participants