Setting the ACCEPT Header in Flash 9.0

Posted on 2009-05-26
Medium Priority
Last Modified: 2013-11-11
I am setting the ACCEPT header in a UrlRequest, but when I inspect the inbound request to the server the ACCEPT header is set twice.  Once the default that Flash sets it to and once for my request.  Is there something special you have to do so that flash will not set the default?  What am I doing wrong?  Applicable code below.
var register_loader:URLLoader = new URLLoader();
var register_request:URLRequest = new URLRequest( path );
register_request.method = URLRequestMethod.POST;
register_request.requestHeaders = new Array();
register_request.requestHeaders.push( new URLRequestHeader("ACCEPT", "text/javascript"));
register_loader.load( register_request);

Open in new window

Question by:mynamebecory2
  • 2
LVL 22

Expert Comment

ID: 24483875

if it is set once by flash, do you really need to set it then?

rp / ZA

Author Comment

ID: 24523054
Yes, flash always sets its to text/html, I need it set to text/javascript (or whatever I want it set to).  The problem is flash sets it, then when I try to set it, instead of overriding the "default" it just appends an additional Accept header.  The end result is that the server receiving the request only looks at the first Accept header, and thus sends back the wrong content type.

Accepted Solution

mynamebecory2 earned 0 total points
ID: 24523079
The headers end up looking something like this:
GET / HTTP/1.1
Cache-Control: max-age=0
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: __vokle_session_id=3643559748ef191732d6764dc6aabc52
Connection: keep-alive
Accept: text/javascript (This is the one i added, above is the one flash adds)


Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question