go-telegram/bot

models.InputFileUpload without pointer compiles but does not work

Closed this issue · 2 comments

This code compiles and works fine:

b.SendDocument(ctx, &bot.SendDocumentParams{
	ChatID:   123,
	Document: &models.InputFileUpload{Filename: "my.txt", Data: myReader},
})

The same code but without & before models.InputFileUpload fails with the next error:

unexpected response statusCode 400 for method sendDocument, {"ok":false,"error_code":400,"description":"Bad Request: invalid file HTTP URL specified: Wrong port number specified in the URL"

Expected behaviour: this should also work (or just fail with an obvious error message).

By library API design, models.InputFileUpload should be provided by pointer.
I'm not sure this needs to change. It breaking change

Closed