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

Ticket #8407 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Changeset 6764 broke xhr request parsing

Reported by: tom Assigned to: bitsweat
Priority: high Milestone: 1.x
Component: ActionPack Version: edge
Severity: major Keywords:
Cc:

Description

Since [6764], XMLHttpRequest parameters aren't being set in controllers.

Sorry, I haven't dug around and written a unit test yet, but:

# app/controllers/test_controller.rb
class TestController < ApplicationController
  def create
    render :inline => "#{request.raw_post}, #{params.to_json}"
  end
end

# app/views/test/index.html.erb
<div id="content">
<%- form_remote_tag :url => '/test/create', :update => 'content' do -%>
  <input name="foo" type="text" />
<%- end -%>
</div>

With source:trunk/actionpack#6763, you see

foo=bar, {action: "create", foo: "bar", controller: "test"}

which is correct behaviour.

With source:trunk/actionpack#6765, you see

foo=bar, {action: "create", controller: "test", "/test/create": null}

which isn't.

Attachments

ajax-request-param-parsing.diff (1.2 kB) - added by jsierles on 05/19/07 20:39:49.

Change History

05/19/07 20:39:49 changed by jsierles

  • attachment ajax-request-param-parsing.diff added.

05/19/07 20:40:32 changed by jsierles

This problem seems to be due to the charset set on XHR requests. A failing test and working patch is attached. Not sure if this is the intended behavior, but it works.

05/19/07 20:41:24 changed by jsierles

  • summary changed from Changeset 6764 broke xhr request parsing to [PATCH] Changeset 6764 broke xhr request parsing.

05/19/07 20:50:26 changed by jsierles

To clarify, after this fix, the {"/test/create": null} parameter still persists. It must originate from somewhere outside the request since the bug caused a null request hash to be returned.

05/19/07 21:34:41 changed by bitsweat

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

(In [6786]) Fix incorrent content type lookup in request parsing. Closes #8407.