-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow URL encoded dataset in libhoney endpoint paths (#1199)
## Which problem is this PR solving? Allow URL encoded dataset names in /event and /batch endpoint. For example, to send data to a dataset with the name `foo/bar`, you can now send data like this: ``` curl -i -H "x-honeycomb-team: <api-key>" -X POST 'http://localhost:8080/1/events/foo%2Fbar' -d '{"name":"mike"}' ``` The dataset name `foo%2Fbar` is URL decoded into `foo/bar` and used as the dataset name. When forwarding events to the Honeycomb API, the dataset name is URL encoded again to ensure it's received into HNY correctly. ## Short description of the changes - Update mux router to allow encoded paths - Add utility function to get the dataset from mux vars and url escape the value - Add tests for utility function - Simplify batch event processing by removing `batchedEventToEvent`, adding `getSampleRate` batchEvent member func and re-using apiHost and dataset
- Loading branch information
1 parent
9e03f2f
commit 59418df
Showing
2 changed files
with
159 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters