Skip to content

Send Content-Type charset on statement POST requests#619

Open
hashhar wants to merge 1 commit into
trinodb:masterfrom
hashhar:hashhar/600-content-type-header
Open

Send Content-Type charset on statement POST requests#619
hashhar wants to merge 1 commit into
trinodb:masterfrom
hashhar:hashhar/600-content-type-header

Conversation

@hashhar

@hashhar hashhar commented Jul 11, 2026

Copy link
Copy Markdown
Member

Description

Send "text/plain; charset=utf-8" on the statement POST matching the Trino JDBC client (StatementClientV1). The header is set only on POST and uses setdefault so a user-supplied Content-Type still takes precedence.

The client posted the SQL body to /v1/statement without a Content-Type header so no charset was advertised. This breaks Trino Gateway's request analyzer which needs the charset to parse the SQL body for routing rules (it logs "charset is not set in the request" and leaves catalogs/tables/body empty).

Non-technical explanation

Fixes #600

Release notes

(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

* Fix some things. ({issue}`issuenumber`)

Send "text/plain; charset=utf-8" on the statement POST matching the
Trino JDBC client (StatementClientV1). The header is set only on POST
and uses setdefault so a user-supplied Content-Type still takes
precedence.

The client posted the SQL body to /v1/statement without a Content-Type
header so no charset was advertised. This breaks Trino Gateway's request
analyzer which needs the charset to parse the SQL body for routing rules
(it logs "charset is not set in the request" and leaves
catalogs/tables/body empty).

@azawlocki-sbdt azawlocki-sbdt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Development

Successfully merging this pull request may close these issues.

POST /v1/statement requests missing charset in Content-Type header

2 participants