Skip to content
This repository has been archived by the owner on Aug 18, 2018. It is now read-only.

fix: just return empty object for empty responses #9

Merged
merged 2 commits into from
Jan 7, 2018

Conversation

etamponi
Copy link
Member

@etamponi etamponi commented Jan 7, 2018

This avoids JSON parse errors

@zkochan
Copy link
Member

zkochan commented Jan 7, 2018

I think it would be correct to return undefined in this case or the raw value of response.body.

So it can be just return response.body && JSON.parse(response.body)

Also, when does it happen? Can a test be added?

@etamponi
Copy link
Member Author

etamponi commented Jan 7, 2018 via email

@zkochan
Copy link
Member

zkochan commented Jan 7, 2018

You can change the function signature to Promise<object | undefined>

@etamponi
Copy link
Member Author

etamponi commented Jan 7, 2018

Ok, it now returns undefined

@zkochan
Copy link
Member

zkochan commented Jan 7, 2018

ok, if you are able to then add a test. I created an issue #10

@zkochan zkochan merged commit 17519f8 into pnpm:master Jan 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants