Skip to content

Connection.rb: Allow string and empty response body#66

Open
jasonopslevel wants to merge 1 commit into
technicalpickles:mainfrom
OpsLevel:allow-string-response-body
Open

Connection.rb: Allow string and empty response body#66
jasonopslevel wants to merge 1 commit into
technicalpickles:mainfrom
OpsLevel:allow-string-response-body

Conversation

@jasonopslevel
Copy link
Copy Markdown

There are certain responses that only respond with a status code, and an empty body like all of the DELETE requests. For example: delete_webhook.

This change makes parsing the body (in particular, ParseTimeStrings) more permissive, and doesn't raise for valid requests:

connection = PagerDuty::Connection.new(token, token_type: :Bearer)
id = "PXXXXX"
connection.delete("webhook_subscriptions/#{id}")

# before
= >  Can't parse times of String:  (RuntimeError)

# after
 => "" 

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.

1 participant