No results for

Powered byAlgolia
⚠️ This is archived documentation for v0.32. Go to the latest version
NameTypeDescription
Response.statusnumberThe response gRPC status code. Use the gRPC status constants to check equality.
Response.messageobjectThe successful protobuf message, serialized to JSON. Will be null if status !== grpc.StatusOK.
Response.headersobjectKey-value pairs representing all the metadata headers returned by the gRPC server.
Response.trailersobjectKey-value pairs representing all the metadata trailers returned by the gRPC server.
Response.errorobjectIf status !== grpc.StatusOK then the error protobuf message, serialized to JSON; otherwise null.

Example

grpc-test.js
import grpc from 'k6/net/grpc';
import { check } from 'k6';
const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
export default () => {
client.connect('grpcb.in:9001', {
// plaintext: false
});
const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
client.close();
sleep(1);
};