Skip to content

fix: #224#272

Open
Flipped199 wants to merge 1 commit into
go-telegram:mainfrom
Flipped199:main
Open

fix: #224#272
Flipped199 wants to merge 1 commit into
go-telegram:mainfrom
Flipped199:main

Conversation

@Flipped199
Copy link
Copy Markdown

Summary

This PR fixes requests for methods without parameters when using a self-hosted Telegram Bot API server.

Previously, rawRequest always created a multipart request body, even when params was nil. That behavior appears to break some self-hosted Bot API implementations for parameterless methods such as getMe.

What changed

  • Send a POST request with a nil body when params is nil
  • Only create io.Pipe and multipart.Writer when parameters are actually present
  • Add a safe isNil helper instead of calling reflect.Value.IsNil() directly on unsupported kinds

Why

This makes parameterless requests behave more like true empty-body HTTP requests instead of empty multipart form uploads.

It also avoids reflection panics for non-nilable value types.

Impact

  • Fixes compatibility with self-hosted/custom Telegram Bot API servers
  • Keeps existing multipart behavior for requests that actually contain parameters
  • Improves safety of nil checks in request building

Related

Fixes #224

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

not supported self hosted telegram API

2 participants