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

feat: httpPost url templating #2388

Merged
merged 1 commit into from
Aug 27, 2020
Merged

feat: httpPost url templating #2388

merged 1 commit into from
Aug 27, 2020

Conversation

docmerlin
Copy link
Contributor

@docmerlin docmerlin commented Aug 21, 2020

This adds templating to the url for httpPost.

  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@docmerlin
Copy link
Contributor Author

docmerlin commented Aug 21, 2020

This closes #2387

@@ -85,14 +89,24 @@ func (e *Endpoint) RowTemplate() *template.Template {
return e.rowTemplate
}

func (e *Endpoint) NewHTTPRequest(body io.Reader) (req *http.Request, err error) {
func (e *Endpoint) URL() *template.Template {
Copy link

Choose a reason for hiding this comment

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

just curious: will the address of e.urlTemplate change? is it safe to return its address without locking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be safe to do this in our case, furthermore, as we are storing a template.Template, so the address won't change relative to the object's address.

services/httppost/service.go Show resolved Hide resolved
services/httppost/config.go Show resolved Hide resolved
This allows for templating urls in post alerts and in httpPost nodes.
@ayang64 ayang64 self-requested a review August 27, 2020 14:18
@docmerlin docmerlin merged commit 05b18a3 into master Aug 27, 2020
@docmerlin docmerlin deleted the template-url branch August 27, 2020 15:40
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.

2 participants