Merge lp:~imbrandon/js-oopsd/jspost into lp:js-oopsd

Proposed by Brandon Holtsclaw
Status: Needs review
Proposed branch: lp:~imbrandon/js-oopsd/jspost
Merge into: lp:js-oopsd
Diff against target: 56 lines (+5/-28)
1 file modified
js/jsoops.js (+5/-28)
To merge this branch: bzr merge lp:~imbrandon/js-oopsd/jspost
Reviewer Review Type Date Requested Status
Richard Harding (community) Approve
Review via email: mp+123442@code.launchpad.net

Description of the change

change from http GET to POST in jsoops.js

To post a comment you must log in.
lp:~imbrandon/js-oopsd/jspost updated
14. By Brandon Holtsclaw

typo

Revision history for this message
Richard Harding (rharding) wrote :

Thanks for the update to POST. It'd be nice to have tests to go with this, but as this is it looks ok.

review: Approve

Unmerged revisions

14. By Brandon Holtsclaw

typo

13. By Brandon Holtsclaw

cleanup of unused code

12. By Brandon Holtsclaw

adding xhr post to jsoops.js

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'js/jsoops.js'
--- js/jsoops.js 2012-08-10 05:53:08 +0000
+++ js/jsoops.js 2012-09-10 19:50:22 +0000
@@ -6,26 +6,17 @@
6 REPORTER : '',6 REPORTER : '',
7 EndPoint : 'https://js-oopsd-endpoint.example.com/',7 EndPoint : 'https://js-oopsd-endpoint.example.com/',
8 handle: function (msg,url,line) {8 handle: function (msg,url,line) {
9 var request = document.createElement('iframe');
10 request.style.width = '1px';
11 request.style.height = '1px';
12 request.style.display = 'none';
13 var data = new Object();;9 var data = new Object();;
14 data.msg = msg;10 data.msg = msg;
15 data.url = url;11 data.url = url;
16 data.line = line;12 data.line = line;
17 data.lang = "js";13 data.lang = "js";
18 data.reporter = jsoops.REPORTER;14 data.reporter = jsoops.REPORTER;
19 var api_url = jsoops.EndPoint + '?' + jsoops.customEscape(data);15 var xhr = new XMLHttpRequest();
20 request.src = api_url;16 xhr.open("POST", jsoops.EndPoint);
21 if (document.body) {17 xhr.setRequestHeader('Content-Type', 'application/json');
22 document.body.appendChild(request);18 xhr.send(JSON.stringify(data));
23 } else{19 return url;
24 addLoadEvent(function() {
25 document.body.appendChild(request);
26 });
27 };
28 return api_url;
29 },20 },
30 setEndPoint: function (host) {21 setEndPoint: function (host) {
31 jsoops.EndPoint = host;22 jsoops.EndPoint = host;
@@ -46,20 +37,6 @@
46 jsoops.handle(msg,url,line);37 jsoops.handle(msg,url,line);
47};38};
4839
49function addLoadEvent(func) {
50 var oldonload = window.onload;
51 if (typeof window.onload != 'function') {
52 window.onload = func;
53 } else {
54 window.onload = function() {
55 if (oldonload) {
56 oldonload();
57 }
58 func();
59 };
60 }
61}
62
63// add JSON support - from here https://github.com/douglascrockford/JSON-js (Public domain)40// add JSON support - from here https://github.com/douglascrockford/JSON-js (Public domain)
64if(!this.JSON)this.JSON={};41if(!this.JSON)this.JSON={};
65(function(){function k(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=42(function(){function k(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=

Subscribers

People subscribed via source and target branches

to all changes: