Closed andrewshell closed 2 years ago
@andrewshell -- what's the upshot -- do you think this code should change?
The upshot is if someone calls that function expecting it to ping the server, it currently won't when urlServer is undefined.
Ideally, the function would just require the urlServer parameter and not accept undefined as a value.
Or just remove the function cloudPing
entirely so daverss doesn't need to depend on request. Then it's just a library for generating RSS feeds.
What’s the problem? I haven’t touched this code in two years, I’m certainly not going to break things. Are you getting errant calls on your server?
That's fine. I was building a project that used this library and I noticed the bug. My guess is nobody uses that function with undefined so it's not a big deal.
I did a search of my own code and find that rss.cloudPing is indeed called with undefined as the first param, in fact it's the normal way to call it because most apps don't have an opinion about which rssCloud server to use, they want the default.
So here's what I'm going to do.
There will be no breakage, because the previous implementation with /pleaseNotify as the path didn't work.
I also did a light code review, and have to say there is other code here that makes even less sense, but it does work when you use it to generate RSS feeds, so I'm going to stick with it. I have bigger fish to fry right now.
Also the reason cloudPing is in this package is the next thing you want to do after publishing a feed is ping the rssCloud server. So this is where it should be. It makes no sense to take it out. I understand you probably don't like the deprecation warning for request, but I actually kind of like it because I think it's totally nuts to even conceive of taking such a core routine out of the NPM feature set. For the first N years this was the only way to do a request, now supposedly it won't work anymore. I'll believe it when I see it. ;-)
That looks good. That should fix it for anybody using the function.
In the function
cloudPing
, ifurlServer
is undefined, it generates its ownurlServer
fromrssCloudDefaults
which defines the path as "/pleaseNotify".This is the only place where
rssCloudDefaults
is used, and if the function is supposed to ping the rssCloud server, the path should be "/ping".