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

Support querystring parameters on the dsn #27

Merged
merged 3 commits into from
Mar 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/raven_clj/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@
:uri (format "%s://%s" protocol
(string/join
"/" (butlast (string/split url #"/"))))
:project-id (Integer/parseInt (last (string/split url #"/")))}))
:project-id (-> (string/split url #"/")
(last)
(string/split #"\?")
(first)
(Integer/parseInt))}))

(defn capture
"Send a message to a Sentry server.
Expand Down
7 changes: 7 additions & 0 deletions test/raven_clj/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@

(testing "dsn parsing with port and path"
(is (= (parse-dsn "https://b70a31b3510c4cf793964a185cfe1fd0:[email protected]:9000/sentry/1")
{:key "b70a31b3510c4cf793964a185cfe1fd0"
:secret "b7d80b520139450f903720eb7991bf3d"
:uri "https://example.com:9000/sentry"
:project-id 1})))

(testing "dsn parsing with query parameters"
(is (= (parse-dsn "https://b70a31b3510c4cf793964a185cfe1fd0:[email protected]:9000/sentry/1?environment=test&servername=example")
{:key "b70a31b3510c4cf793964a185cfe1fd0"
:secret "b7d80b520139450f903720eb7991bf3d"
:uri "https://example.com:9000/sentry"
Expand Down