Hi. I am trying to find a way to mock protobuf res...
# general
Hi. I am trying to find a way to mock protobuf response. I have a json mapping. Want to convert that as protobuf response.
Wondering if wiremock supports that
Hi @Ramya Vedagiri WireMock doesn’t support Protobuf right now, but you could write a custom matcher extension to do this
I see. Thanks for the info
@Tom Looks like custom matcher is for extensive use. Like if we are looking for something specific in request . However, my requirement is simple: I just look for the URI and header tag. If it matches then it need to return the response back as a protobuf
So, would I still need custom matcher for this?
If you don’t need to match on a protobuf request, and just need a protobuf response then you shouldn’t need to write an extension.
You’d need to encode the protobuf as base64 then return it as a binary response
Cool. Any samples would be great
Are you configuring your stubs via Java or JSON?
In that case you should be able to put the protobuf response in a file under the
folder and create a stub mapping like:
Copy code
    "request": {
        "method": "POST",
        "url": "/proto"
    "response": {
        "status": 200,
        "bodyFileName": "my-data.proto" // The name of the file under __files
@Tom I tried use the suggested way, and I see exception on client side when I deserialize 'EntityResponse response = response.getEntity(EntityResponse.class)' com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException: Protocol message tag had invalid wire type. The message is encoded and sent as binary. Not sure what am I missing here