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: builtin func refactor for github #25

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jsmvaldivia
Copy link
Contributor

@jsmvaldivia jsmvaldivia commented May 21, 2022

  • Splitting logic for GitHub request builtin
  • Updated type from interface{} to any in the changed files
  • Found a minor bug and fixed it: When evaluating a situation where there are no path params as they are, for example, hardcoded already, the range cycle over those path params would fail

@jsmvaldivia jsmvaldivia self-assigned this May 21, 2022
@jsmvaldivia jsmvaldivia added bug Something isn't working enhancement New feature or request labels May 21, 2022
@jsmvaldivia jsmvaldivia marked this pull request as ready for review May 21, 2022 17:34
Copy link
Member

@wtfiscrq wtfiscrq left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me, just left a few comments.

func buildRequestUrl(path string, data map[string]any) (string, error) {
pathParams := parsePathParams(path)

if len(pathParams) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I believe this condition is not necessary. If pathParams is empty the for isn't executed anyway.

u.RawQuery = qs.Encode()

return r.Client.NewRequest(method, u.String(), nil)
return u.String(), err
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to return nil here instead of err. Telling explicitly there was no error (err can have a value that we handled and we'd be returning it anyway).

}
}

//Testing request path strings to url request
Copy link
Member

Choose a reason for hiding this comment

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

Missed the space between the // and comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants