I decided to try using jQuery for once because it was already included in the page. I found out that it has very convenient $.ajax method that allows you to produce readable Ajax calls.
I learned how to add custom headers to the call, since I need to authorize at Imgur. This is my code:
  $.ajax({
    url: 'https://api.imgur.com/3/image',
    type: 'POST',
    headers: {
      Authorization: 'Client-ID ' + APP_ID,
      Accept: 'application/json'
    },
    data: {
      image: SavePage.getimgrc(),
      type: 'base64'
    },
    success: function(result) {
      var id = result.data.id;
      window.location = 'https://imgur.com/gallery/' + id;
    }
  });
Well, no matter how convenient it is, it does not work as advertised:
POST /3/image HTTP/1.1
Host: api.imgur.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 20956
Origin: resource://jid0-gxjllfbcoax0lcltedfrekqdqpi-at-jetpack
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
So, is it broken or did I screw it up?
 
    