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

Adds more plan functionality #146

Merged
merged 6 commits into from
May 16, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Handle 300 response codes better
  • Loading branch information
ktayah committed May 16, 2022
commit cc14fad780d32a7467fd6dab852f17e72662f32f
7 changes: 6 additions & 1 deletion lib/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ defmodule Braintree.HTTP do

:erlang.raise(kind, reason, __STACKTRACE__)
else
{:ok, code, _headers, body} when code in 200..399 ->
{:ok, code, _headers, body} when code in 200..299 ->
duration = System.monotonic_time() - start_time
emit_stop(duration, method, path, code)
{:ok, decode_body(body)}

{:ok, code, _headers, _body} when code in 300..399 ->
duration = System.monotonic_time() - start_time
emit_stop(duration, method, path, code)
{:ok, ""}

{:ok, 422, _headers, body} ->
duration = System.monotonic_time() - start_time
emit_stop(duration, method, path, 422)
Expand Down