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

Add Pingback feature #38

Merged
merged 8 commits into from
Oct 12, 2018
Merged

Add Pingback feature #38

merged 8 commits into from
Oct 12, 2018

Conversation

PascalPiche
Copy link
Contributor

No description provided.

@nitriques nitriques changed the title Add Pingback featured Add Pingback feature Sep 24, 2018
lib/pingback.js Outdated
'result': data.result,
'action': data.action,
'url': data.url,
'source': 'algolia-crawler'
Copy link
Member

Choose a reason for hiding this comment

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

Please do not quote keys

app.js Outdated
console.log(data.message);
}
}
});
Copy link
Member

Choose a reason for hiding this comment

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

I do not think we need to output anything here. Simply append to the errors array

Copy link
Member

Choose a reason for hiding this comment

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

lib/pingback.js Outdated

res.setEncoding('utf8');

console.log(res.statusCode);
Copy link
Member

Choose a reason for hiding this comment

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

Please remove!

lib/pingback.js Outdated
res.setEncoding('utf8');

console.log(res.statusCode);
process.exit();
Copy link
Member

Choose a reason for hiding this comment

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

Please remove !

lib/pingback.js Outdated
console.log(res.statusCode);
process.exit();

if (res.statusCode === 404) {
Copy link
Member

Choose a reason for hiding this comment

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

We do not need to handle 404 differently that if it is non-200

app.js Outdated
if (pingback.ok == false) {
console.log('No ping back url configured or bad url.');
console.log(pingback.error);
console.log();
Copy link
Member

Choose a reason for hiding this comment

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

I do not thing we need this error, since no pingback is ok.

README.md Outdated
result=[success|error]
action=[update|delete]
url=the url inserted
source=”algolia-crawler”
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the smart quotes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

I still see them...

app.js Outdated
console.log(data.message);
}
}
});
Copy link
Member

Choose a reason for hiding this comment

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

@fhamon
Copy link
Contributor

fhamon commented Oct 3, 2018

Should we include a unit test too ?

README.md Outdated
result=[success|error]
action=[update|delete]
url=the url inserted
source=”algolia-crawler”
Copy link
Member

Choose a reason for hiding this comment

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

I still see them...

app.js Outdated

//Add empty line
console.log();

Copy link
Member

Choose a reason for hiding this comment

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

We can remove that empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quote removed from readme.md

app.js Outdated
result: 'success',
action: 'delete',
url: url.url
}, tearDown);
Copy link
Member

Choose a reason for hiding this comment

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

Why not pass the callback in the data object ?

Copy link
Member

Choose a reason for hiding this comment

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

And why wait for the pingback to complete ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To keep console log in sync.

Copy link
Member

Choose a reason for hiding this comment

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

ah ok

app.js Show resolved Hide resolved
lib/pingback.js Outdated
err: err
});
};
req.on('error', (e) => callback(e));
Copy link
Member

Choose a reason for hiding this comment

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

There are too many functions here. Either pass callback directly to error, or inline it. I think that the inline is the best.

@nitriques
Copy link
Member

@fhamon Pretty hard to unit test a http request...

@fhamon
Copy link
Contributor

fhamon commented Oct 11, 2018

@nitriques This could be usefull ? https://github.com/nock/nock

@nitriques
Copy link
Member

@fhamon yes it would! but mocking is a little bit like voodoo.

@nitriques nitriques merged commit 1b73854 into DeuxHuitHuit:dev Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants