No results for

Powered byAlgolia
⚠️ This is the archived documentation for k6 v0.45. Go to the latest version.

Client.invoke(url, request [,params])

Invokes an unary RPC request to the given method.

The given method to invoke must have its RPC schema previously loaded via the Client.load() function, otherwise an error will be thrown.

Client.connect() must be called first before invoking a request, otherwise an error will be thrown.

urlstringThe gRPC method url to invoke, in the form /package.Service/Method, e.g. / The leading slash / is optional.
requestobjectThe canonical request object, as-per the Protobuf JSON Mapping.
params (optional)objectParams object containing additional request parameters.


ResponsegRPC Response object.


import grpc from 'k6/experimental/grpc';
import { check } from 'k6';
const client = new grpc.Client();
client.load([], 'routeguide.proto');
export default () => {
client.connect('localhost:10000', { plaintext: true });
const response = client.invoke('main.RouteGuide/GetFeature', {
latitude: 410248224,
longitude: -747127767,
check(response, { 'status is OK': (r) => r && r.status === grpc.StatusOK });
// output: 3 Hasta Way, Newton, NJ 07860, USA