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

Handle 204 status code #155

Merged
merged 2 commits into from
Nov 27, 2017
Merged

Handle 204 status code #155

merged 2 commits into from
Nov 27, 2017

Conversation

AverageMarcus
Copy link
Contributor

When updating a call a 204 response is returned (such as when hanging up an active call). Currently this is seen as an error by the lib but the action does perform correctly but doesn't provide any response body.

(Created again after messing up #154.)

@AlexLakatos AlexLakatos self-requested a review October 16, 2017 08:56
@AlexLakatos
Copy link
Contributor

Thanks @AverageMarcus ! Continuing the discussion from #154 ,agreed with @judy2k that a 204 should return null.

@@ -123,6 +123,8 @@ class HttpClient {
headers['retry-after'] = retryAfterMillis;
}
error = {body: data.join('')};
} else if (status === 204) {
response = data;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we return null here instead please?

@@ -271,6 +271,14 @@ describe('parseResponse', function() {
expect(callback).was.calledWith({ statusCode: 404, body: { 'error' : 'error' }, headers: headers}, null);
});

it ('should parse a 204 status code as a JSON object', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

and update the test as well. We shouldn't parse a 204 as JSON

@mheap mheap merged commit 6062154 into Vonage:master Nov 27, 2017
@mheap
Copy link
Contributor

mheap commented Nov 27, 2017

LGTM - I've merged it in to master. Thanks @AverageMarcus!

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.

3 participants