https://linen.dev logo
#general
Title
# general
v

Vishnu Rs

08/14/2023, 6:29 AM
Any idea how to mock bytes/byte array in the Wiremock JSON stub as the request body? I’m trying to mock the gRPC byte stream.
o

Oleg Nenashev

08/14/2023, 6:49 AM
Hi. Have you tried https://github.com/wiremock/grpc-wiremock, just in case?
Maybe it is easier
v

Vishnu Rs

08/14/2023, 7:40 AM
I tried this, but now I’m trying a different solution to mock the Internal Http2 call of the gRPC call using Wiremock. I’ve got the OutBound/InBound Data from the netty-shaded-server logs. But don’t know how to mock this byte data in wiremock stub.
GrpcMethod method POST, scheme http, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.43.0, grpc-accept-encoding: gzip, grpe-timeout: 384S exclusive=false padding=0 endStream=true - 2023-08-14 120941.433 DEBUG [acceptanceTests-xxxxx,,] 24412 - - - [-worker-ELG-1-4] i.g.n.s.i.grpc.netty.NettyClientHandlerMDC R: Localhost/127.0.0.1:68001 OUTBOUND DATA: streamId=3 padding=0 endStream-true length-11 bytes=00000000060a0412023135
I’m trying to mock this bytes data in the wiremock stub
“request”: { “method”: “POST”, “Url”: “/com.sabre. ticketing.tktdispensing. grpc. stub/method, “headers”: { “Content-Type”: { “equalTo”: “application/grpc” }}, “bodyPatterns”: [ { “binaryEqualTo”: “00000000060a0412023135” }
something like this
@Oleg Nenashev, any idea?
o

Oleg Nenashev

08/14/2023, 8:56 AM
I don't have an immediate answer, need to look into the documentation later today and maybe to prototype it
v

Vishnu Rs

08/14/2023, 8:56 AM
okay, thank you
3 Views