-
Notifications
You must be signed in to change notification settings - Fork 341
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
Adding Request struct and process_response/1 #311
Conversation
OH hey! I like the idea! I would probably just try to avoid changing so many things at the same as this will break pretty much every code that is using HTTPoison 😶 Do you think we can simplify this PR so it just adds the What do you reckon? |
@edgurgel maybe we could make it for a v2.0? 😇 |
that's a little bit along the lines of what i've mentioned in #345 (comment), isn't it? (just trying to understand the motivation of the change here) though i agree with @edgurgel that it might be rather heavy for a single PR - no matter if it's a major version jump or just a minor. |
Yeah I'll take some time and trim it back a bit |
c47b540
to
3585af7
Compare
@edgurgel I trimmed it back to mostly just the request struct as well as adding process_response/1 (which should help with #345 as well). I kept the New
|
@ryanwinchester that's fantastic! I'm pretty sure we can get this released soon. I will review it asap 👍 |
I've got a bit of stuff to work out on this, yet, actually. |
Okay, all good 🤞 😇 |
I added some callbacks named a little more consistently with eachother, but kept the ones they are replacing. Implementation:@deprecated "Use process_request_url/1 instead"
@spec process_url(url) :: url
def process_url(url) do
HTTPoison.Base.default_process_request_url(url)
end
@spec process_request_url(url) :: url
def process_request_url(url), do: process_url(url) @deprecated "Use process_response_headers/1 instead"
@spec process_headers(list) :: any
def process_headers(headers), do: headers
@spec process_response_headers(list) :: any
def process_response_headers(headers), do: process_headers(headers) @deprecated "Use process_response_status_code/1 instead"
@spec process_status_code(integer) :: any
def process_status_code(status_code), do: status_code
@spec process_response_status_code(integer) :: any
def process_response_status_code(status_code), do: process_status_code(status_code) All the non-deprecated and new process_* callbacks:process_request_url
process_request_body
process_request_headers
process_request_options
process_request_params
process_response
process_response_headers
process_response_status_code
process_response_body
process_response_chunk I find this a lot more explicit and less ambiguous about what is being processed. I don't see it being backwards incompatible yet, since the newly named ones call the old versions unless overridden. Let me know if you want them axed anyway. |
Thanks for the PR! I really appreciate the time taken to deprecate functions and document everything. I'm hoping to have a new release soon. <3 🎉 |
First of all, thank you so much for this project, it has been a pleasure using it.
I know this might be a stretch, but I needed to do a bit of a refactor to make it better-suited for some libraries I want to start soon.
I'm hoping we can get some of this in here instead of me making a fork. 😇😅 Let me know if this is a direction you're willing to go and if there are any changes you'd like to see to actually get this merged (since I know I took quite a few liberties, to my own personal tastes 🤣)