gRPC
Client Streaming
StreamRequestValidateMedium
Description
Send multiple products to create in bulk (client โ server streaming).
Test Scenario
// grpcurl client streaming (requires file with JSON lines)
echo '{"name": "Product 1", "price": 10.99}
{"name": "Product 2", "price": 20.99}
{"name": "Product 3", "price": 30.99}' | \
grpcurl -plaintext -d @ \
localhost:50051 \
practice.products.ProductService/BulkCreateProducts
// Single response after all products sent:
{
"created": 3,
"failed": 0,
"productIds": ["prod-1", "prod-2", "prod-3"]
}Testing Tips
- โขClient sends multiple requests
- โขServer responds once after all received
- โขGood for uploads, batch operations
// Playwright API Testing - gRPC (via REST gateway)import { test, expect } from '@playwright/test';test('gRPC unary call via gateway', async ({ request }) => {const response = await request.post('/api/grpc/UserService/GetUser', {data: { id: '1' }});expect(response.ok()).toBeTruthy();const data = await response.json();expect(data.user).toBeDefined();});
Challenge ID: grpc-client-streaming
2 frameworks available