You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ze...@apache.org on 2025/01/23 22:29:29 UTC

(iceberg-go) branch main updated: Do not set Content-type header in doPost (#268)

This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new 4b645d6  Do not set Content-type header in doPost (#268)
4b645d6 is described below

commit 4b645d698fffaa99c235f54bf33f4340a4414bc5
Author: Rick Curtis <ri...@deltastream.io>
AuthorDate: Thu Jan 23 16:29:24 2025 -0600

    Do not set Content-type header in doPost (#268)
    
    This change shouldn't really be necessary..... but I just spent the
    better part of an afternoon tracking it down.
    
    I've been testing against snowflake opencatalog and it appears that
    they're running some older version of `polaris` where a bug exists where
    if you specify a `Content-Type` header multiple times on a `POST` you'll
    get a cryptic 400 back from the server. I wasn't able to find a bug in
    `apache/polaris`, but the problem doesn't happen on main.
    
    Seems safe to do as the header is [defaulted
    here.](https://github.com/apache/iceberg-go/blob/main/catalog/rest.go#L555)
    
    ```
    iceberg-go/rgc % curl -X GET -H "Authorization: Bearer xxx" \
            -H 'Accept: application/json' \
            -H 'Accept: application/json' \
            -H 'Content-Type: application/json' \
            -H 'Content-Type: application/json' \
            https:/*******.snowflakecomputing.com/polaris/api/catalog/v1/test-catalog/namespaces
    {
    "servlet":"com.sun.jersey.spi.container.servlet.ServletContainer-16626b18",
    "message":"Bad Request",
    "url":"/polaris/api/catalog/v1/test-catalog/namespaces",
    "status":"400"
    ```
---
 catalog/rest.go | 2 --
 1 file changed, 2 deletions(-)

diff --git a/catalog/rest.go b/catalog/rest.go
index 636d04e..3326a3d 100644
--- a/catalog/rest.go
+++ b/catalog/rest.go
@@ -287,8 +287,6 @@ func doPost[Payload, Result any](ctx context.Context, baseURI *url.URL, path []s
 		return
 	}
 
-	req.Header.Add("Content-Type", "application/json")
-
 	rsp, err = cl.Do(req)
 	if err != nil {
 		return