Results 1 to 3 of 3

Thread: Ext.Ajax - POST custom text in HTTP body

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    23
    Answers
    2
    Vote Rating
    0
      0  

    Default Answered: Ext.Ajax - POST custom text in HTTP body

    Hi,

    I need to send text content of local file in HTTP body using Ext.Ajax.request.
    Code:
    Ext.Ajax.request({
     url: 'test.jsp',
     params: 'data to send',
     method: 'POST',
     headers: {
      'Content-Type': 'my custom content type'
     }
    });
    The problem is my custom Content-Type header is not set in the request properly.
    What causes that behavior ? How to deal with that ?

    Best regards kkris1983

  2. Problem lies in our application. We accidentally overwrote all the headers on Ext.Ajax.on('beforerequest') that is why headers I applied wasn't sent at all. I am able to send enything in HTTP body with correct Content-Type header

    Thanks

  3. #2
    Sencha User friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
      0  

    Default

    Ajax (think "XMLHttpRequest") doesn't allow you to encode and send local file content. This can only be performed by an HTML Form post, which allows you to set the content type to multipart/form-data.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    23
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Problem lies in our application. We accidentally overwrote all the headers on Ext.Ajax.on('beforerequest') that is why headers I applied wasn't sent at all. I am able to send enything in HTTP body with correct Content-Type header

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •