Skip to content

SendFaxMessage does not support sending without files. #15

Description

@grokify

When sending without a file the following error is encountered:

$ go run fax_send.go -to=+16505550100
panic: Status: 400 Bad Request, Body: {
  "message" : "Bad Request",
  "errors" : [ ]
}

This is handled by MessagesApi.SendFaxMessage:

https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L530

func (a *MessagesApiService) SendFaxMessage(ctx context.Context, accountId string, extensionId string, localVarFile *os.File, faxResolution string, to []string, localVarOptionals map[string]interface{}) (FaxResponse, *http.Response, error) {

It sets up the following vars.

	var (
		localVarHttpMethod = strings.ToUpper("Post")
		localVarPostBody   interface{}
		localVarFileName   string
		localVarFileBytes  []byte
		successPayload     FaxResponse
	)

localVarFileName and localVarFileBytes are not populated when localVarFile is nil, however it is still sent to prepareRequest:

https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L600

r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

Need to investigate what happens in client.prepareRequest with empty localVarFileName and localVarFileBytes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions