From 3a32eb6dd03e3ca708e602122d734607f7af3953 Mon Sep 17 00:00:00 2001 From: Aleksander Zaruczewski Date: Tue, 18 Jul 2023 16:00:36 +0400 Subject: [PATCH] fix(privatelink): gcp create use empty json in request (#301) --- gcp_privatelink.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcp_privatelink.go b/gcp_privatelink.go index 867af64..9ff6b1b 100644 --- a/gcp_privatelink.go +++ b/gcp_privatelink.go @@ -40,7 +40,12 @@ type ( func (h *GCPPrivatelinkHandler) Create(project, serviceName string) (*GCPPrivatelinkResponse, error) { path := buildPath("project", project, "service", serviceName, "privatelink", "google") - bts, err := h.client.doPostRequest(path, nil) + // TODO: Remove struct{}{} when API is fixed, and use nil instead. See below for more details. + // + // Currently this endpoint requires a body, even though it's not used to process the request. + // We can't use nil because it's not a valid JSON, and the API returns a 400, so we use an empty struct. + // When the API is fixed, we can remove this workaround and use nil. + bts, err := h.client.doPostRequest(path, struct{}{}) if err != nil { return nil, err }