Feat: support bin header in gRPC (#5869)

* Fix -bin header handling in grpc

* fix: bin-header, tests

rm: tests

rm: unused

fix: bin header

fix: test

fix: test

rm: un-necessarycode

---------

Co-authored-by: Juan Pablo Orsay <jporsay@gmail.com>
This commit is contained in:
sanish chirayath
2025-10-31 17:07:12 +05:30
committed by GitHub
parent f3afb4bf84
commit 08c182a875
14 changed files with 320 additions and 140 deletions

View File

@@ -0,0 +1,9 @@
{
"version": "1",
"name": "Grpcbin",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}

View File

@@ -0,0 +1,27 @@
meta {
name: SayHello
type: grpc
seq: 1
}
grpc {
url: grpc://grpcb.in:9000
method: /hello.HelloService/SayHello
body: grpc
auth: inherit
methodType: unary
}
metadata {
test-bin: hello
test: hello
}
body:grpc {
name: message 1
content: '''
{
"greeting": "amoveo"
}
'''
}

View File

@@ -0,0 +1,10 @@
{
"collections": [
{
"path": "{{projectRoot}}/tests/grpc/metadata/fixtures/collection",
"securityConfig": {
"jsSandboxMode": "safe"
}
}
]
}

View File

@@ -0,0 +1,11 @@
{
"maximized": true,
"lastOpenedCollections": [
"{{projectRoot}}/tests/grpc/metadata/fixtures/collection"
],
"preferences": {
"beta": {
"nodevm": false
}
}
}

View File

@@ -0,0 +1,32 @@
import { test, expect } from '../../../playwright';
import { closeAllCollections } from '../../utils/page';
test.describe('grpc metadata', () => {
test.afterAll(async ({ pageWithUserData: page }) => {
await closeAllCollections(page);
});
test('should handle binary metadata', async ({ pageWithUserData: page }) => {
await test.step('Open the request', async () => {
const collection = page.locator('#sidebar-collection-name').filter({ hasText: 'Grpcbin' });
await collection.click();
const request = page.locator('.collection-item-name').filter({ hasText: 'SayHello' });
await request.click();
});
await test.step('Verify request sent successfully', async () => {
await page.getByTestId('grpc-send-request-button').click();
const statusCode = page.getByTestId('grpc-response-status-code');
const statusText = page.getByTestId('grpc-response-status-text');
await expect(statusCode).toBeVisible({ timeout: 30000 });
await expect(statusText).toBeVisible({ timeout: 30000 });
await expect(statusCode).toHaveText(/0/);
await expect(statusText).toHaveText(/OK/);
});
/* TODO: Reflection fetching incorrectly marks requests as modified, causing save indicators to appear. This save step prevents test timeouts by clearing the modified state. This is a temporary workaround until the reflection fetching issue is resolved. */
await test.step('save request via shortcut', async () => {
await page.keyboard.press('Meta+s');
});
});
});