Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    115
    Vote Rating
    127
    fdp is a glorious beacon of light fdp is a glorious beacon of light fdp is a glorious beacon of light fdp is a glorious beacon of light fdp is a glorious beacon of light fdp is a glorious beacon of light

      0  

    Default Ext 4.2.1 Ext.data.proxy.reader.Reader success even if no success in response

    Ext 4.2.1 Ext.data.proxy.reader.Reader success even if no success in response


    Consider a Proxy with a Json Reader,
    the reader Url returns an empty response,
    There is no "success":true or "success":false response
    The response is considered a success and all exception events are not fired

    Ext code is here:
    Code:
            if (me.successProperty) {
                value = me.getSuccess(data);
                if (value === false || value === 'false') {
                    success = false;
                }
            }
    I think it is better consider unsuccessfully a response with success undefined

    Full proof here (see console log):
    http://jsfiddle.net/kzaxG/

    Code:
    /*
     http://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js
     http://cdn.sencha.io/ext-4.2.0-gpl/resources/ext-theme-neptune/ext-theme-neptune-all.css
     Ext 4.2.1 Ext.data.proxy.reader.Reader success even if no success in response
     */
    
    
    Ext.application({
      name: 'MyApp',
      launch: function () {
        console.log("MyApp launch");
        var row = Ext.create('MyApp.model.Contact', {
          id_contact: 123,
          contact_firstname: 'abc'
        });
        row.save({
          failure: function (record, operation, success) {
            console.log("Model save failure");
          },
          success: function (record, operation, success) {
            console.log("Model save success");
          },
          callback: function (record, operation, success) {
            console.log("Model save callback");
          }
        });
      }
    });
    
    
    Ext.define('MyApp.model.Proxy', {
      extend: 'Ext.data.proxy.Ajax',
      reader: {
        type: 'json',
        root: 'root'
      },
      writer: {
        type: 'json',
        allowSingle: false
      },
      constructor: function (config) {
        var me = this;
        me.callParent([config || {}]);
        me.on('exception', me.onException, me);
      },
      onException: function (proxy, response, operation) {
        console.warn("Proxy exception for operation: " + operation.action + ' url: ' + response.request.options.url + ' response: ' + response.responseText);
      } // onException
    });
    
    
    Ext.define('MyApp.model.Contact', {
      extend: 'Ext.data.Model',
      idPropery: 'id_contact',
      fields: [
        {name: 'id_contact', type: 'int'},
        {name: 'contact_firstname', type: 'string'}
      ],
      proxy: Ext.create('MyApp.model.Proxy', {
        // see http://doc.jsfiddle.net/use/echo.html
        url: '/echo/js/?js=' // this return http status 200 with response empty
      })
    });
    Regards

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,959
    Vote Rating
    212
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

    This sounds like a breaking change - the dev team will review the report and discuss internally.

Thread Participants: 1

Tags for this Thread