proxy-wasm-go-sdk
proxy-wasm-go-sdk copied to clipboard
test framework: Mock DispatchHttpCall to return error
I am doing unit tests for my filter with DispatchHttp, something like this:
_, err = proxywasm.DispatchHttpCall(ctx.clusterName, headers, body, nil, ctx.timeout, ctx.callback)
if err != nil {
proxywasm.LogCriticalf("big error: %v", err)
proxywasm.ResumeHttpRequest()
return types.ActionContinue
}
I don't know of a way to mock the DispatchHttpCall method in order to return an error so we can cover this part of the code.
Is there any way of doing this?