alessandro-nori commented on code in PR #2074:
URL: https://github.com/apache/iceberg-go/pull/2074#discussion_r4169380405
##########
catalog/rest/rest_test.go:
##########
@@ -2773,9 +2773,50 @@ var (
}`, exampleViewMetadataJSON)
)
+func (r *RestCatalogSuite) TestUpdatePathsEncodeNamesAndBodiesRemainRaw() {
+ const objectName = "a b+c"
+
+ type updatePayload struct {
+ Identifier struct {
+ Name string `json:"name"`
+ } `json:"identifier"`
+ }
+
+ r.mux.HandleFunc("/v1/namespaces/table-ns/tables/", func(w
http.ResponseWriter, req *http.Request) {
+ r.Equal("/v1/namespaces/table-ns/tables/a%20b%2Bc",
req.URL.EscapedPath())
+
+ var payload updatePayload
+ r.Require().NoError(json.NewDecoder(req.Body).Decode(&payload))
+ r.Equal(objectName, payload.Identifier.Name)
+
+ _, err := w.Write([]byte(createTableRestExample))
+ r.Require().NoError(err)
+ })
+
+ r.mux.HandleFunc("/v1/namespaces/view-ns/views/", func(w
http.ResponseWriter, req *http.Request) {
+ r.Equal("/v1/namespaces/view-ns/views/a%20b%2Bc",
req.URL.EscapedPath())
+
+ var payload updatePayload
+ r.Require().NoError(json.NewDecoder(req.Body).Decode(&payload))
+ r.Equal(objectName, payload.Identifier.Name)
+
+ _, err := w.Write([]byte(createViewRestExample))
+ r.Require().NoError(err)
+ })
+
+ cat, err := rest.NewCatalog(context.Background(), "rest", r.srv.URL)
+ r.Require().NoError(err)
+
+ _, err = cat.UpdateTable(context.Background(),
table.Identifier{"table-ns", objectName}, nil, nil)
Review Comment:
I can add these tests as part of the refactor PR for r.NoError()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]