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

Fix deletes & updates breaking on "unexpected end of JSON input" #16

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

costasd
Copy link
Contributor

@costasd costasd commented Oct 13, 2023

Call is always attempting to parse response body, which leads to errors in case
of no-response calls such as nameserver.deleteRecord.

In order to allow for such without breaking our API, let's:

  • rename the original Call into _Call
  • introduce a boolean of expectResponseBody into _Call
  • offer a new Call that keeps the stable interface, but translates into _Call(..., true)
  • offer a new CallNoResponseBody that can be used by such no-response calls

Then,

Use the new client.CallNoResponseBody instead of client.Call and avoid erroring
on body failing to parse in NameserverRecordUpdate & NameserverRecordDelete.

Fixes #12

Call is always attempting to parse response body, which leads to errors in case
of no-response calls such as nameserver.deleteRecord.

In order to allow for such without breaking our API, let's:
* rename the original Call into _Call
* introduce a boolean of `expectResponseBody` into _Call
* offer a new Call that keeps the stable interface, but translates into _Call(..., true)
* offer a new CallNoResponseBody that can be used by such no-response calls
According to API, the underlying calls don't return any response body.

Use client.CallNoResponseBody instead of client.Call and avoid erroring
on body failing to parse (as it is empty).

Given the empty body, no call.Code is available, so remove this part as well.
@costasd costasd mentioned this pull request Oct 13, 2023
@fsoederhuyzen fsoederhuyzen merged commit 95ab831 into inwx:main Oct 19, 2023
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.

Deletion fails
2 participants