Skip to content

Commit

Permalink
Fix regex to support query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Jul 14, 2021
1 parent ab5af69 commit aa3efe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion axiom/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
ErrUnprivilegedToken = errors.New("using ingest token for non-ingest operation")
)

var validIngestTokenPathRe = regexp.MustCompile("^/api/v1/(datasets/.+/ingest|tokens/ingest/validate)$")
var validIngestTokenPathRe = regexp.MustCompile("^/api/v1/(datasets/.+/ingest|tokens/ingest/validate)")

// Error is the generic error response returned on non 2xx HTTP status codes.
// Either one of the two fields is populated. However, calling the Error()
Expand Down
4 changes: 4 additions & 0 deletions axiom/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ func TestIngestPathRegex(t *testing.T) {
input: "/api/v1/datasets/test/ingest",
match: true,
},
{
input: "/api/v1/datasets/test/ingest?timestamp-field=time",
match: true,
},
{
input: "/api/v1/tokens/ingest/validate",
match: true,
Expand Down

0 comments on commit aa3efe3

Please sign in to comment.