mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 22:54:07 +00:00
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:
9
tests/grpc/metadata/fixtures/collection/bruno.json
Normal file
9
tests/grpc/metadata/fixtures/collection/bruno.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "Grpcbin",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
27
tests/grpc/metadata/fixtures/collection/sayHello.bru
Normal file
27
tests/grpc/metadata/fixtures/collection/sayHello.bru
Normal 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"
|
||||
}
|
||||
'''
|
||||
}
|
||||
10
tests/grpc/metadata/init-user-data/collection-security.json
Normal file
10
tests/grpc/metadata/init-user-data/collection-security.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"collections": [
|
||||
{
|
||||
"path": "{{projectRoot}}/tests/grpc/metadata/fixtures/collection",
|
||||
"securityConfig": {
|
||||
"jsSandboxMode": "safe"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
11
tests/grpc/metadata/init-user-data/preferences.json
Normal file
11
tests/grpc/metadata/init-user-data/preferences.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"maximized": true,
|
||||
"lastOpenedCollections": [
|
||||
"{{projectRoot}}/tests/grpc/metadata/fixtures/collection"
|
||||
],
|
||||
"preferences": {
|
||||
"beta": {
|
||||
"nodevm": false
|
||||
}
|
||||
}
|
||||
}
|
||||
32
tests/grpc/metadata/with-bin-metadata.spec.ts
Normal file
32
tests/grpc/metadata/with-bin-metadata.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user