Opened 7 years ago

Closed 7 years ago

#170 closed enhancement (fixed)

make override-ext-ajax.js work for form-encoded POST

Reported by: bartvde Owned by:
Priority: major Milestone: 0.7
Component: overrides Version: trunk
Keywords: Cc:
State: Commit

Description

I finally got time to track down the following:

http://www.geoext.org/pipermail/dev/2009-July/000281.html

I don't think an ExtJS user should have to change his requests in order for this to work, it should work out of the box the same way it works against the ExtJS Ajax lib.

I'll attach a patch with a testcase.

Example request of what should work:

        Ext.Ajax.request({
            failure: function(response) { },
            method: 'POST',
            success: function(response) {
                console.log(response);
            },
            params: { username: 'eijdenb', password: 'xxxx', application: 'mapviewer2', loadstartwmc: 'on' },
            url: 'http://test.intranet.rijkswaterstaat.nl/apps/geoservices/geoservices2.2/authenticate.php'
        });

Attachments (2)

ticket170.patch (1.9 KB) - added by bartvde 7 years ago.
patch including a testcase
ticket170.2.patch (2.0 KB) - added by bartvde 7 years ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by bartvde

patch including a testcase

comment:1 Changed 7 years ago by bartvde

  • State changed from None to Review

comment:2 Changed 7 years ago by elemoine

shouldn't this be done in OpenLayers? Note that I'm not against having it in GeoExt, but I just think it may make more sense to have it in the lower layer.

comment:3 follow-up: Changed 7 years ago by bartvde

Hmm, good question, I did not think about that. But where would it be done in OpenLayers? If I read:

http://faq.openlayers.org/ajax/how-do-i-post-form-encoded-data/

then OpenLayers uses the same param (data) for form-encoded data as for XML, so we would need to interpret the contents of data to find out. Would that be desired behaviour?

comment:4 in reply to: ↑ 3 Changed 7 years ago by elemoine

  • State changed from Review to Commit

Replying to bartvde:

Hmm, good question, I did not think about that. But where would it be done in OpenLayers? If I read:

http://faq.openlayers.org/ajax/how-do-i-post-form-encoded-data/

then OpenLayers uses the same param (data) for form-encoded data as for XML, so we would need to interpret the contents of data to find out. Would that be desired behaviour?

You're right, interpreting the content of data isn't something we want to do in my opinion.

I think you're patch in good to go, maybe you could just combine the two if statements in one single statement:

if(options.params && (!hs || !hs["Content-Type"])) {

comment:5 Changed 7 years ago by bartvde

  • Resolution set to fixed
  • Status changed from new to closed

(In [1443]) make override-ext-ajax.js work for form-encoded POST, r=elemoine (closes #170)

comment:6 Changed 7 years ago by bartvde

Using Ext 2.3 I now had a situation in which options.params was undefined, so instead I checked for options.form. I need to add a testcase for form submit to ensure all is working fine in that specific case.

comment:7 Changed 7 years ago by bartvde

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening since form submit fails.

Changed 7 years ago by bartvde

comment:8 Changed 7 years ago by bartvde

  • State changed from Commit to Review

comment:9 Changed 7 years ago by elemoine

  • State changed from Review to Commit

looks good, please commit

comment:10 Changed 7 years ago by bartvde

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [1898]) Making sure form submit succeeds as well with override-ext-ajax.js, r=elemoine (closes #170)

Note: See TracTickets for help on using tickets.