Decent Dabbler
Decent Dabbler

Reputation: 22793

Is it possible to access multiple response headers of the same kind?

With the following code:

URLRequestDefaults.manageCookies = false;

var urlRequest:URLRequest = new URLRequest();
urlRequest.url = 'http://example.com/some/file/sending/multiple/same/headers';
var urlLoader:URLLoader = new URLLoader();
try
{
    urlLoader.addEventListener( HTTPStatusEvent.HTTP_RESPONSE_STATUS, function( event:HTTPStatusEvent ):void {
        trace( 'response headers length: ' + event.responseHeaders.length );
        for each( var responseHeader:URLRequestHeader in event.responseHeaders )
        {
            trace( responseHeader.name + ': ' + responseHeader.value );
        }
    } );
    urlLoader.load( urlRequest );
}
catch( error:SecurityError )
{
    trace( 'A SecurityError has occurred.' );
}

... I'm trying to access multiple Set-Cookie response headers, but this doesn't seem possible. It seems that AIR overwrites earlier received response headers of the same kind.

Is there any way to circumvent this behaviour, without, for instance, having to use/write a Socket based HTTP client?

edit:

Just to clear up possible confusion: I'm talking about multiple Set-Cookie response headers received in a single response.

Upvotes: 3

Views: 326

Answers (1)

kakridge
kakridge

Reputation: 2303

Your code looks correct to me. The issue is likely the response you are getting.

Upvotes: 2

Related Questions