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

breaking: support parsing of valid falsy json #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DonutEspresso
Copy link
Member

As part of revving dependencies, I discovered a regression in JSONClient. I'm not sure when it happened, it looks like the tests were not even checking for the right thing.

Essentially, if the server sends 0, null, or false, that is valid JSON and the client should respect it. This is similar to restify/node-restify#1609.

@coveralls
Copy link

coveralls commented Jul 14, 2018

Coverage Status

Coverage increased (+0.01%) to 87.927% when pulling 3470786 on rev-restify into b86b6d7 on master.

// --- Tests

describe('restify-client tests', function () {

before(function (callback) {
try {
SERVER = restify.createServer({
dtrace: dtrace,
Copy link
Member Author

Choose a reason for hiding this comment

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

7.x no longer takes dtrace as a function, it's now a boolean. Removed as it wasn't super important for the client tests.

@misterdjules
Copy link
Contributor

Is that really a regression, it seems that the erroneous behavior may have been present for a while. For instance, the commit at fb52f48#diff-1f5c7c63b7ce8433f5b0480296a5f265R57 uses:

obj = obj || {};

to set the response object. Wouldn't that have the same problem? If so, that commit was merged ~2015, wouldn't that make this PR semver major?

@DonutEspresso
Copy link
Member Author

@misterdjules You're right - I confused this with restify's ability to send these values as strings (but not for restify-client's ability to parse those strings as valid JSON).

I guess this is indeed semver major.

@DonutEspresso DonutEspresso changed the title fix: support parsing of valid falsy json breaking: support parsing of valid falsy json Jul 19, 2018
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.

5 participants