Skip to content

Commit a0ee127

Browse files
olegbespalovcodebien
authored andcommitted
Document gRPC's -bin metadata
1 parent 1346576 commit a0ee127

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/data/markdown/docs/02 javascript api/07 k6-experimental/02 grpc/20-Params.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ excerpt: 'Params is an object used by the gRPC methods that generate RPC request
88

99
| Name | Type | Description |
1010
|------|------|-------------|
11-
| `Params.metadata` | object | Object with key-value pairs representing custom metadata the user would like to add to the request. |
11+
| `Params.metadata` | object | Object with key-value pairs representing custom metadata the user would like to add to the request. Values of [keys ending with `-bin`](https://grpc.io/docs/what-is-grpc/core-concepts/#metadata) will be treated as binary data. |
1212
| `Params.tags` | object | Key-value pairs where the keys are names of tags and the values are tag values. Response time metrics generated as a result of the request will have these tags added to them, allowing the user to filter out those results specifically, when looking at results data. |
1313
| `Params.timeout` | string / number | Request timeout to use. Default timeout is 60 seconds (`"60s"`). <br/> The type can also be a number, in which case k6 interprets it as milliseconds, e.g., `60000` is equivalent to `"60s"`. |
1414

@@ -29,7 +29,10 @@ export default function () {
2929
longitude: -747127767,
3030
};
3131
const params = {
32-
metadata: { 'x-my-header': 'k6test' },
32+
metadata: {
33+
'x-my-header': 'k6test',
34+
'x-my-header-bin': new Uint8Array([1, 2, 3]),
35+
},
3336
tags: { k6test: 'yes' },
3437
};
3538
const response = client.invoke('main.RouteGuide/GetFeature', req, params);

src/data/markdown/docs/02 javascript api/11 k6-net-grpc/20-Params.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ excerpt: 'Params is an object used by the gRPC methods that generate RPC request
88

99
| Name | Type | Description |
1010
|------|------|-------------|
11-
| `Params.metadata` | object | Object with key-value pairs representing custom metadata the user would like to add to the request. |
11+
| `Params.metadata` | object | Object with key-value pairs representing custom metadata the user would like to add to the request. Values of [keys ending with `-bin`](https://grpc.io/docs/what-is-grpc/core-concepts/#metadata) will be treated as binary data. |
1212
| `Params.tags` | object | Key-value pairs where the keys are names of tags and the values are tag values. Response time metrics generated as a result of the request will have these tags added to them, allowing the user to filter out those results specifically, when looking at results data. |
1313
| `Params.timeout` | string / number | Request timeout to use. Default timeout is 60 seconds (`"60s"`). <br/> The type can also be a number, in which case k6 interprets it as milliseconds, e.g., `60000` is equivalent to `"60s"`. |
1414

@@ -29,7 +29,10 @@ export default function () {
2929
longitude: -747127767,
3030
};
3131
const params = {
32-
metadata: { 'x-my-header': 'k6test' },
32+
metadata: {
33+
'x-my-header': 'k6test',
34+
'x-my-header-bin': new Uint8Array([1, 2, 3]),
35+
},
3336
tags: { k6test: 'yes' },
3437
};
3538
const response = client.invoke('main.RouteGuide/GetFeature', req, params);

0 commit comments

Comments
 (0)