pushbullet-js
pushbullet-js copied to clipboard
PushBullet.deletePush(pushId)
When I'm doing this I get an error in the Chrome Console: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://api.pushbullet.com/v2/pushes/pushId'.
This is because Google catches the error.
This is a part of the HTML:
400. That’s an error. ##
Your client has issued a malformed or illegal request. That’s all we know.
I don't know if this is because it does not work with HTTP DELETE, or another error.
If you need more information, let me know! Thanks.
I believe this is an issue with PushBullet's end. Upon testing, I got the following:
XMLHttpRequest cannot load https://api.pushbullet.com/v2/pushes/<pushId>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
This likely means that the PushBullet devs don't have the CORS headers properly configured.
Yes, that's what I already thought. I also thought, maybe I missed something :P
I will mail them to get it resorted, keep you informed :)
I think alex already emailed me about this. Can you post the exact request here (all headers, you can edit out the access token) so I can debug the issue?
I get a 400 Bad Request from Google Front End
To reproduce, just a HTML page with included pushbullet-js script and the following code:
PushBullet.APIKey = 'YOUR_API_KEY';
var res = PushBullet.push("note", null, null, {title: "<your title here>", body: "<your body here>"});
var pushId = res.iden;
var res = PushBullet.deletePush(pushId);
Here are all the details about the request:
Request URL: https://api.pushbullet.com/v2/pushes/[pushId] Request Method: DELETE Status Code: 400 Bad Request
Request Headers :host: api.pushbullet.com :method: DELETE :path: /v2/pushes/[pushId] :scheme: https :version: HTTP/1.1 accept: / accept-encoding: gzip,deflate accept-language: nl,en-US;q=0.8,en;q=0.6 authorization: Basic [authorizationHash] content-length: 4 content-type: application/json origin: http://domain.com referer: http://domain.com/pushbullet/pushbulletjs.htm user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2101.0 Safari/537.36
Request Payload null
Response Headers connection: close content-length: 1419 content-type: text/html; charset=UTF-8 date: Wed, 30 Jul 2014 19:44:58 GMT server: GFE/2.0 status: 400 Bad Request version: HTTP/1.1
I haven't tried to reproduce your error, but from the looks of it you're sending the payload "null". DELETE does not allow a payload and it looks like your request isn't getting to my server because the google front end servers are rejecting it as invalid. Could you try without the payload?
Ahh. It looks like I finally get how GitHub works, sort of. The 'strangest' thing is that you need to always fork, even if you are not planning to do anything else than fixing a bug.
Thanks @christopherhesse, that was the key :)
Closing as this is already fixed
I've tested this again, because I had to delete some pushes. And it's the same problem again.
I've solved it locally with the following: if(parameters) { ajax.send(parameters); to if(parameters && parameters != "null") { ajax.send(parameters);
I thought this was already fixed and finished. :)
Seriously? That makes no sense. How is it possible for parameters to equal "null"? I know that javascript has weak typing, but it can't be THAT weak.
Do you mind giving me some sample code that replicates this problem?
Sorry, little delay :)
This should fail, and give a 500 Internal Server Error or something like that.
// Delete first push
PushBullet.pushHistory(function(err, res) {
PushBullet.deletePush(res.pushes[0].iden);
});
Hi Alex,
Any progress on the test framework? :)
Thanks!
I know, I've really been slacking on this. I'm working on finals this week, and I hope to really spend some time on all the projects I've been working on (this included), starting this weekend.
Now? :P
Ever? :)
It's not that I wait on this. But I see it's still opened.