twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
271 stars 40 forks source link

MockBaseClient broken by 1.20.0 update which changed the function signature of SendRequest #244

Closed saurori closed 2 months ago

saurori commented 2 months ago

Issue Summary

Version 1.20.0 changed the BaseClient SendRequest method (seen in this pull request) to add body ...byte as a function parameter. The corresponding MockBaseClient was not updated.

Steps to Reproduce

  1. Use twilio-go version 1.20.1
  2. Attempt to use a MockBaseClient (see code below)

Code Snippet

ctrl := gomock.NewController(t)
c := client.NewMockBaseClient(ctrl)
twilioClient := twilio.NewRestClientWithParams(twilio.ClientParams{Client: c})

Exception/Log

cannot use c (variable of type *client.MockBaseClient) as client.BaseClient value in struct literal: *client.MockBaseClient does not implement client.BaseClient (wrong type for method SendRequest)
        have SendRequest(string, string, url.Values, map[string]interface{}) (*http.Response, error)
        want SendRequest(string, string, url.Values, map[string]interface{}, ...byte) (*http.Response, error)compiler[InvalidIfaceAssign](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#InvalidIfaceAssign)

Technical details:

sbansla commented 2 months ago

Let me take a look into this.

tiwarishubham635 commented 2 months ago

Hey @saurori! I have created a PR #246 for this. Please check. Thanks!