Skip to content

Conversation

@andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo added the WIP work in progress label Apr 7, 2020
@andreaangiolillo andreaangiolillo requested a review from gssbzn April 7, 2020 11:33
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

@andreaangiolillo this is working with a quick test I did, it may need some more love so leaving it with you

}

req.Header.Add("Content-Type", mediaType)
if body != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

only set the Content-Type if there's a body

// pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface,
// the raw response will be written to v, without attempting to decode it.
func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) {
resp, err := DoRequestWithClient(ctx, c.client, req)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to get rid of DoRequestWithClient since it doe snot offer any advantage but I don't know if someone is using it

if err != nil {
return nil, err
decErr := json.NewDecoder(resp.Body).Decode(v)
if decErr == io.EOF {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a small bug fix I did for om, bringing it here

@andreaangiolillo andreaangiolillo requested a review from gssbzn April 7, 2020 15:36
@andreaangiolillo andreaangiolillo removed the WIP work in progress label Apr 7, 2020
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

Couple of nits, mostly with adding a body payload to the gzip request, I think this can be completly avoided do to the nature of the request

@andreaangiolillo andreaangiolillo requested a review from gssbzn April 7, 2020 16:54
@andreaangiolillo andreaangiolillo added the WIP work in progress label Apr 9, 2020
@andreaangiolillo andreaangiolillo requested a review from gssbzn April 9, 2020 09:08
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

I don't think this solves what we agreed to do with Get and Download let mw know if you want to chat about it

@andreaangiolillo andreaangiolillo requested a review from gssbzn April 9, 2020 11:05
@andreaangiolillo andreaangiolillo removed the WIP work in progress label Apr 9, 2020
@andreaangiolillo andreaangiolillo requested review from gssbzn and removed request for gssbzn April 9, 2020 16:21
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

Couple of small suggestions but we are almost there

@andreaangiolillo andreaangiolillo requested a review from gssbzn April 9, 2020 16:50
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

small nitpicks with handling of errors

@andreaangiolillo andreaangiolillo requested a review from gssbzn April 9, 2020 17:15
Copy link
Contributor

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

LGTM, great work here, I know it took some effort

@gssbzn
Copy link
Contributor

gssbzn commented Apr 9, 2020

@themantissa this is ready for review, it includes some changes on how requests are created/executed to let us handle gzip request so you may want to give that some extra attention
(along with some improvements)

@themantissa themantissa self-requested a review April 9, 2020 23:33
Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

This looks good from my general perspective but definitely need either Paco or Marin to check the downstream impact to the Terraform provider, Vault and CloudFormation for the work in mongodbatlas.go and mongodbatlas_test.go. May take them a bit longer to review this one so keep that in mind.

@themantissa
Copy link
Collaborator

@PacoDw and @marinsalinas as the two most familiar with this client and all the downstream consumers ( Terraform provider, Vault and CloudFormation) can you in particular review the changes in mongodbatlas.go, and mongodbatlas_test.go, especially around the new request interface, etc? This may take a bit longer so if we need to use retainer hours that is fine.

Copy link
Contributor

@marinsalinas marinsalinas left a comment

Choose a reason for hiding this comment

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

I have a question, will the gzip request be only GET requests? If not we have to keep in mind to add body validation in gzip request right?

@gssbzn
Copy link
Contributor

gssbzn commented Apr 10, 2020

@marinsalinas yes, we don't have POST APIs that return gzip content

Copy link
Contributor

@marinsalinas marinsalinas left a comment

Choose a reason for hiding this comment

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

LGTM!

@gssbzn gssbzn merged commit 1fbdd98 into master Apr 12, 2020
@gssbzn gssbzn deleted the CLOUDP-60178 branch April 12, 2020 15:18
gssbzn pushed a commit to gssbzn/go-client-mongodb-atlas that referenced this pull request Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants