Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Is it possible to remove isc_dataFormat from the request (RestDataSource)

    When data is fetched from a DataSource class as defined below...

    Code:
    isc.defineClass('CustomersDataSource', isc.RestDataSource);
    CustomersDataSource.addProperties({
        dataFormat: 'json',
    
        dataURL: '/customers',
    
        operationBindings: [
          { operationType: 'fetch', dataProtocol: 'getParams' },
          { operationType: 'add', dataProtocol: 'postParams' },
          { operationType: 'update', dataProtocol: 'postParams', requestProperties: { httpMethod: 'PUT' } },
          { operationType: 'remove', dataProtocol: 'postParams', requestProperties: { httpMethod: 'DELETE' } }
        ],
    
        sendMetaData: false,
    
        transformRequest: function (request) {
          if (request.operationType === 'fetch') {
            request.params = isc.addProperties({}, request.params, {
              offset: request.startRow,
              limit: request.endRow - request.startRow
            });
          } else {
            request.params = isc.addProperties({}, request.params, {
              authenticity_token: Backend.getProperties().authenticity_token
            });
          }
          return this.Super('transformRequest', arguments);
        }
    });
    The request that is done, is something like:

    /customers?offset=0&limit=38&isc_dataFormat=json

    Is it possible to get the isc_dataFormat parameter removed?

    #2
    After calling Super(), remove it from request.params.

    Comment

    Working...
    X