-
Notifications
You must be signed in to change notification settings - Fork 6
Plug support #49
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
Plug support #49
Conversation
8e54b20
to
931945a
Compare
plug CurlReq.Plug This is now possible |
fn -> | ||
conn | ||
|> CurlReq.Plug.decode() | ||
|> CurlReq.Curl.encode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super cool
lib/curl_req/plug.ex
Outdated
``` | ||
|
||
|
||
Add a filter function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this is the place where people have to do something if they don't want their login requests to be logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! I will improve the docs to make that clearer and supply some use cases. Also thinking about both types of filtert to either include/reject based on a user defined boolean function. Sometimes you only want to log on a specific route and sometimes you would want to exclude a specific route (you can use the complete conn struct so it doesn't have to be only routes but you can define rules on header or method or whatever)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derekkraan i updated the docs with a better example. This filter function already has the ability to allow/reject depending on the way you write you filter logic so i decided against my idea for a filter and reject function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great! Sorry it took me so long to get around to reviewing this PR!
Closes #47
In your Phoenix Controller you can now write something like this: