Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Publish Integration Test #3591

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions internal/gqlclient/gqlclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ func (c *Client) runWithFiles(ctx context.Context, gqlReq RequestWithFiles, resp
logging.Debug("gqlclient: response: %s", responseData)
}

intermediateResp := make(map[string]interface{})
gr := &graphResponse{
Data: response,
Data: &intermediateResp,
}
req = req.WithContext(ctx)
c.Log(fmt.Sprintf(">> Raw Request: %s\n", req.URL.String()))
Expand Down Expand Up @@ -371,5 +372,20 @@ func (c *Client) runWithFiles(ctx context.Context, gqlReq RequestWithFiles, resp
if err := json.Unmarshal(resp, &gr); err != nil {
return errors.Wrap(err, "decoding response")
}
return nil

if len(intermediateResp) == 1 {
Copy link
Contributor

@mitchell-as mitchell-as Nov 13, 2024

Choose a reason for hiding this comment

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

Nit: a comment describing why this conditional is here or what conditions it may occur under would probably be useful for anyone debugging around this area in the future. However, I recognize the follow up ticket may end up addressing this, so I leave it up to you.

for _, val := range intermediateResp {
data, err := json.Marshal(val)
if err != nil {
return errors.Wrap(err, "remarshaling response")
}
return json.Unmarshal(data, response)
}
}

data, err := json.Marshal(intermediateResp)
if err != nil {
return errors.Wrap(err, "remarshaling response")
}
return json.Unmarshal(data, response)
}
Loading