2

I'm trying to send up a request to my server with the Accept header set. The code I'm using looks like:

A.io.request(requestUrl, {
    method: 'GET',
    headers: {
        'Accept': acceptHeader
    }
});

However, my developer tools show the header has a value of /, and on the server side when I walk through the property names using resourceRequest.getPropertyNames(), I'm not seeing the header as being set. What am I doing wrong here?

Alternately, my underlying goal is to send a ResourceRequest to the server with the desired content type in the Accept header, and then prompt the user to save that resource. Is there a more correct way to tackle this problem?

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Eric Stein
  • 13,209
  • 3
  • 37
  • 52

1 Answers1

-1

I'm trying to send up a request to my server with the Accept header set

A.io.setHeader('Accept', '');
A.io.setHeader('Accept', acceptHeader);

A.io.request(requestUrl);

Alternately, my underlying goal is to send a ResourceRequest to the server with the desired content type in the Accept header, and then prompt the user to save that resource.

Use the following process:

  • A <form> with a method of POST and a target of _blank to send the request
  • A response with a CONTENT-TYPE header outside of:
    • text/html
    • application/xml
    • application/xhtml+xml
    • text/css
  • A response with a CONTENT-DISPOSITION header of attachment

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265