Modifying request headers in ActionScript 3.0

Though Adobe’s documentation would have you think otherwise, setting or modifying the request headers in an AS3, browser-based Flash application is only possible under certain circumstances. I’m testing this with player version 9,0,115,0 in both Safari 3 and Firefox 2 for OS X.

The documented way to set request headers on an URLRequest object is the following:

var header:URLRequestHeader = new URLRequestHeader("myHeader", "headerValue");
var request:URLRequest = new URLRequest("http://www.[yourdomain].com/");
request.data = new URLVariables("name=John+Doe");
request.requestHeaders.push(header);

However, it seems like you can only modify the headers on a POST request. Which would mean we’d have to specify the POST method (assuming the remote site accepted POST requests for the URL):

request.method = URLRequestMethod.POST;

But even this isn’t sufficient, because the Flash Player will silently convert POST requests into GET requests if the request is empty. So now you have to add URLVariables to the mix:

var variables:URLVariables = new URLVariables();
variables.postVariable = "variableValue";
request.data = variables;

So the only way to successfully set or modify request headers on a URLRequest object is to set its method to POST, and make sure you send at least one variable along with the request. Otherwise the headers will silently remain unchanged.

This is unfortunate as it makes it difficult to connect a browser-based Flash application to a truly REST-ful Web service which determines the markup of content based on request headers.

Miscela d’Oro Ciald’Oro ESE Pods

I’ve been using ESE (easy serving espresso) pods for a while now for their convenience and easy clean-up. Many varieties are sold with each pod individually packaged in a nitrogen pouch keeping them fresh for up to a year or more, making them more economical to beans if you only make espresso a couple times a week like me.

I recently purchased a bag of 40 Miscela d’Oro Ciald’Oro ESE Pods off of eBay. I had never tasted Miscela d’Oro coffee, but after reading good things about the brand, I decided to give it a try. The flavor is much stronger and earthier than either the Lavazza or Illy pods I’ve tried, and there is a pleasing amount of crema produced during the pull.

My only regret is that I still have 20 or so Lavazza pods remaining from a previous purchase, but maybe I’ll keep those for guests. ;]

img_0117.JPG