10000 Plug support by kevinschweikert · Pull Request #49 · derekkraan/curl_req · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 6 commits into from
Mar 9, 2025
Merged

Conversation

kevinschweikert
Copy link
Collaborator
@kevinschweikert kevinschweikert commented Feb 16, 2025

Closes #47

In your Phoenix Controller you can now write something like this:

conn
|> CurlReq.Plug.decode()
|> CurlReq.Curl.encode()
|> IO.puts()
  • write tests
  • implement curl_logger plug to attach curl_req to plug pipeline
  • update CHANGELOG

@kevinschweikert
Copy link
Collaborator Author
plug CurlReq.Plug

This is now possible

@kevinschweikert kevinschweikert marked this pull request as ready for review February 17, 2025 10:22
fn ->
conn
|> CurlReq.Plug.decode()
|> CurlReq.Curl.encode()
Copy link
Owner

Choose a reason for hiding this comment

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

This is super cool

```


Add a filter function
Copy link
Owner

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.

Copy link
Collaborator Author

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)

Copy link
Collaborator Author

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

Copy link
Owner
@derekkraan derekkraan left a 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!

@kevinschweikert kevinschweikert merged commit f932cdf into derekkraan:main Mar 9, 2025
7 checks passed
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.

Generate cURL command from Plug
2 participants
0