Showing posts with label Request Headers. Show all posts
Showing posts with label Request Headers. Show all posts

Tuesday, April 21, 2009

REQUEST HEADERS in FLEX using GET - POST Methods


We can modify Request Header in Flex under the certain circumstances only

var header:URLRequestHeader = new URLRequestHeader("newHeader", "newValue");
var request:URLRequest = new URLRequest("http://www.[vrathore.blogspot].com/");
request.data = new URLVariables("name=Varun+Rathore");
request.requestHeaders.push(header);

However, its possible to modify the headers on a POST request only.
request.method = URLRequestMethod.POST;

This should be taken care that we specifically give the request method as the Flash Player will convert POST requests into GET requests if the request is empty.

Other thing which should be kept in mind is to pass atleast one variable along with the request. Otherwise the headers will remain unchanged.
var variables:URLVariables = new URLVariables();
variables.name = "newValue";
request.data = variables;

Cheers
Varun Rathore

About Me