[ 3 posts ]

David Gardner

  • Username: dgardner
  • Joined: Wed Apr 14, 2010 9:49 am
  • Posts: 4
  • IRC: grdnerd
  • Offline
  • Profile

Connection: Accept application/json for file upload post

Post Posted: Thu Aug 26, 2010 5:04 pm
+0-
Not sure why but I seem to be unable to set the accept header when doing a form post with the connection manager.

The following code snipet always sents with the accept header of "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
so when the browser gets a document back with the content type of application/json it prompts the user.
If I don't set the content type on the server the code works as expected.

Code:
                var C =  YAHOO.util.Connect;
                C.setForm(ul_form, true);
                var post_url = '/browser/json_upload_thumbnail/'+asset_path;
                C.initHeader("Accept", "application/json");
                var d = C.asyncRequest('POST', post_url, callback);

Thomas S. Sha

YUI Contributor

  • Username: tsha
  • Joined: Thu Jan 08, 2009 10:16 am
  • Posts: 206
  • Offline
  • Profile

Re: Connection: Accept application/json for file upload post

Post Posted: Thu Aug 26, 2010 5:52 pm
+0-
The parameters passed to setForm() indicate a file upload operation. In this mode, the request and response are facilitated through an iframe. If the response Content-Type is not set to some variation of "text/*", or if the Content-Type is not mapped to an application handler, it will throw the dialog to prompt for user action.

Regards,
Thomas

David Gardner

  • Username: dgardner
  • Joined: Wed Apr 14, 2010 9:49 am
  • Posts: 4
  • IRC: grdnerd
  • Offline
  • Profile

Re: Connection: Accept application/json for file upload post

Post Posted: Mon Aug 30, 2010 7:51 am
+0-
Ah OK thanks, that works for me.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum