Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4613 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 2 years ago

[PATCH] Prototype/ajax.js multipart encoded POSTs

Reported by: bboisvert@gmail.com Assigned to: sam
Priority: normal Milestone:
Component: Prototype Version:
Severity: normal Keywords:
Cc:

Description

The current (1.5.0_rc0) Ajax.Request.request method always passes form parameters as a urlencoded query string. Unfortunatedly, it doesn't do any escaping, so values with ampersands (for example) cause a malformed request.

I've added multipart POST support to the method. Note that it will only be invoked when a POST is performed, and when postBody is not a string. In other words, a string value of postBody (the only type accepted at the moment) will continue to behave as it always has. If those conditions are met, then postBody is considered to be a generic Object with name/value pairs that represent the form fields to be POSTed. They're serialized, the contentType for the request is changed, and processing continues as normal.

Two new constants on the Ajax.Base class were added to store the content type strings for easier access where needed.

Attachments

patch.txt (2.1 kB) - added by bboisvert@gmail.com on 04/06/06 05:36:56.
patchfile for src/ajax.js to add multipart POST support

Change History

04/06/06 05:36:56 changed by bboisvert@gmail.com

  • attachment patch.txt added.

patchfile for src/ajax.js to add multipart POST support

10/09/06 08:52:35 changed by mislav

  • status changed from new to closed.
  • resolution set to wontfix.

This is bloating in my opinion. No malformed requests are made by Ajax.Request if you know what you're doing and when to use which method.

I'm marking this closed - reopen if you really have a strong reason for this (and a better solution, too!) other than your encoding problems.

(follow-up: ↓ 4 ) 08/01/07 20:24:03 changed by dob

  • status changed from closed to reopened.
  • resolution deleted.

This is bloat? This is a patch to allow prototype's Ajax object to POST multipart encoded forms, functionality which doesn't seem to yet exist and which I, at least, could really use. What's the problem with the proposed solution?

08/03/07 08:24:24 changed by Tobie

  • status changed from reopened to closed.
  • resolution set to wontfix.

I suppose you need multipart encoded forms to upload pics/files, etc... you can't do that with ajax anyway. Closing as wontfix again. (again, feel free to reopen it if you have a good reason to do so).

(in reply to: ↑ 2 ) 08/04/07 23:34:36 changed by mislav

Replying to dob:

This is bloat?

This is YAGNI (you aren't gonna need it). We roll features in when either we or the community needs it. This would be so rare of a usage case that it's just not worth it. What prevents you from subclassing the Ajax.Request object?