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

Add Support for setting headers #204

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jgchristopher
Copy link

I specifically wanted to be able to set the "If-None-Match" header using a previously received ETag.

I updated all of the User Event list functions.

Update user event lists to support passing in an ETag value
Support passing in headers to Tentacat
@coveralls
Copy link

coveralls commented Feb 6, 2021

Coverage Status

Coverage increased (+0.05%) to 92.145% when pulling 47cec7d on jgchristopher:master into 6e4de63 on edgurgel:master.

@edgurgel
Copy link
Owner

edgurgel commented Feb 8, 2021

Hey thanks for the PR! Will have a look this week! Cheers!

defp extra_headers do
Application.get_env(:tentacat, :extra_headers, [])
defp extra_headers(headers) do
Application.get_env(:tentacat, :extra_headers, headers)
Copy link
Owner

Choose a reason for hiding this comment

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

I was wondering if here we would like to concatenate extra_headers with headers?

@edgurgel
Copy link
Owner

I think the PR looks good for what it does. Would we like to support passing etag as a more generic option so that any Tentacat function could potentially pass etag as an option instead of the raw header? The etag option would ultimately build the appropriate header ?

@jgchristopher
Copy link
Author

Sorry, was distracted the last few weeks.

Yes, I can look at implementing more generically in options.

@jgchristopher
Copy link
Author

I think the PR looks good for what it does. Would we like to support passing etag as a more generic option so that any Tentacat function could potentially pass etag as an option instead of the raw header? The etag option would ultimately build the appropriate header ?

Just so I understand, you are referring to something more like

@spec list_public(Client.t(), binary, Keyword.t) :: Tentacat.response()
Tentacat.Users.Events.list(client, "bastos", [etag: "2a97f8e2fba8b548ae56bce4074f25cc00674f213963d2f8cf579b8a3"])

@edgurgel
Copy link
Owner

Hi @jgchristopher !

Yeah that's pretty much what I had in mind. These optional arguments can be sent from basically any API call that we need to and it's extensible enough that we don't end up with tons of arguments that are mostly optional?

What do you think?

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.

None yet

3 participants