From 28318df957f498c969d46c589cc1e238a37e48c1 Mon Sep 17 00:00:00 2001 From: Chen Keinan Date: Sat, 10 May 2025 19:53:13 +0300 Subject: [PATCH 1/3] chore: temp-change Signed-off-by: Chen Keinan --- pkg/client/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index 2521bf3..4ee3472 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -120,16 +120,19 @@ func (c *CfClient) GraphqlAPI(ctx context.Context, query string, variables any, "query": query, "variables": variables, } + fmt.Println("GraphqlAPI Request", query, variables) res, err := c.apiCall(ctx, c.gqlUrl, &RequestOptions{ Method: "POST", Body: body, }) if err != nil { + fmt.Println("GraphqlAPI Error", err) return err } defer res.Body.Close() bytes, err := io.ReadAll(res.Body) + fmt.Println("GraphqlAPI Response", string(bytes)) if err != nil { return fmt.Errorf("failed to read response Body: %w", err) } From e869102f74a45d5d248abb19fd7c20ea12b0fd84 Mon Sep 17 00:00:00 2001 From: Chen Keinan Date: Sat, 10 May 2025 20:06:16 +0300 Subject: [PATCH 2/3] Empty commit message From cc7bd900835afa807d3d5586b0b5809dddc9986a Mon Sep 17 00:00:00 2001 From: Chen Keinan Date: Sun, 11 May 2025 10:15:12 +0300 Subject: [PATCH 3/3] chore: temp-change Signed-off-by: Chen Keinan --- pkg/client/client.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 4ee3472..0274cd3 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -120,23 +120,22 @@ func (c *CfClient) GraphqlAPI(ctx context.Context, query string, variables any, "query": query, "variables": variables, } - fmt.Println("GraphqlAPI Request", query, variables) res, err := c.apiCall(ctx, c.gqlUrl, &RequestOptions{ Method: "POST", Body: body, }) if err != nil { - fmt.Println("GraphqlAPI Error", err) + e,_:=json.Marshal(err) + fmt.Println("GraphQL Error", string(e)) return err } defer res.Body.Close() bytes, err := io.ReadAll(res.Body) - fmt.Println("GraphqlAPI Response", string(bytes)) if err != nil { return fmt.Errorf("failed to read response Body: %w", err) } - + fmt.Println("GraphQL Response", string(bytes)) err = json.Unmarshal(bytes, result) if err != nil { return fmt.Errorf("failed to unmarshal response Body: %w", err) @@ -172,6 +171,7 @@ func (c *CfClient) apiCall(ctx context.Context, baseUrl *url.URL, opt *RequestOp request.Header.Set("Authorization", c.token) request.Header.Set("Content-Type", "application/json") request.Header.Set("origin", c.baseUrl.Host) + fmt.Println("GraphQL Request", method, finalUrl.String(), string(body)) res, err := c.client.Do(request) if err != nil { @@ -185,7 +185,6 @@ func (c *CfClient) apiCall(ctx context.Context, baseUrl *url.URL, opt *RequestOp if err != nil { body = fmt.Sprintf("failed to read response Body: %s", err.Error()) } - return nil, &ApiError{ status: res.Status, statusCode: res.StatusCode,