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

topdown: Add urlquery.decode_object builtin #2670

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

GBrawl
Copy link
Contributor

@GBrawl GBrawl commented Aug 30, 2020

This builtin is the reverse of the encode_object builtin and
makes it easier to use the URI query parameters in policies

Fixes #2647

Signed-off-by: Frederic [email protected]

This builtin is the reverse of the encode_object builtin and
makes it easier to use the URI query parameters in policies

Fixes open-policy-agent#2647

Signed-off-by: Frederic <[email protected]>
return err
}

queryParams, err := url.ParseQuery(string(query))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using ParseQuery here, but if it is better to also include the "?" in the query string we could use https://golang.org/pkg/net/url/#URL.Query instead

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 this version is fine.

Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

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

LGTM

return err
}

queryParams, err := url.ParseQuery(string(query))
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 this version is fine.

@tsandall
Copy link
Member

Thanks for contributing this!

@tsandall tsandall merged commit 870f28f into open-policy-agent:master Aug 31, 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.

Add built-in urlquery.decode_object function
2 participants