Skip to main content
Participant
December 16, 2013
Question

Sending Custom HTTP RequestHeaders

  • December 16, 2013
  • 2 replies
  • 1243 views

I want to send values from Flash to REST Service (Different Domain) through RequestHeader using GET method.

When I use the following code the header values are not attached with the request. Please help me on this

var request:URLRequest = new URLRequest();

request.url="http://www.myexample.com/"

var headers:Array = [new URLRequestHeader("name", "value")];

request.requestHeaders=headers;

request.method = URLRequestMethod.GET;

var loader:URLLoader=new URLLoader(request);

This topic has been closed for replies.

2 replies

Amy Blankenship
Legend
December 20, 2013

Most places that need to use a RESTful service with Flash have a way to fake it--Flash can't send the PUT and DELETE parts.

sinious
Legend
December 16, 2013

Take a look at the GET example here (URLVariables is the key):

http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b061afd5d7127074bbf44-8000.html

Saraav mAuthor
Participant
December 18, 2013

Thanks for your reply. The example is adding the parameters to the URL not adding the request header.

sinious
Legend
December 18, 2013

The URLVariables will be handed to a RESTful service via GET. The URL they're using in the GET example has no URL parameters. The information is contained in the URLVariables to complete the GET request (e.g. variables.method = "test.echo"; // tell the RESTful GET request which method to invoke).