响应在 IE 中返回“201 Created”的 POST 请求,我从 Flash 收到 2032 流错误(Firefox 工作正常)。由于 Flash 不提供对 HTTP 状态的访问,我无法判断它实际上已经成功。正在使用 HTTPService 发出请求。
有什么建议么?有没有其他人看过这个?
谢谢,亚历克斯
响应在 IE 中返回“201 Created”的 POST 请求,我从 Flash 收到 2032 流错误(Firefox 工作正常)。由于 Flash 不提供对 HTTP 状态的访问,我无法判断它实际上已经成功。正在使用 HTTPService 发出请求。
有什么建议么?有没有其他人看过这个?
谢谢,亚历克斯
我在我的 Flex on Rails 应用程序中找到了解决此问题的方法。我在 IE 中看到了同样的问题——我在 Rails 中的 development.log 给出了 201 消息,但这导致了返回给 Flex 的错误。我在 Tony Hillerson 和 Daniel Wanja 合着的一本名为Flex On Rails的新书中找到了参考资料,第 1 页。31. 它涉及捕获 201 错误和更改标题。这是我的 ApplicationController 文件:
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
include AuthenticatedSystem
before_filter :login_required
after_filter :flex_error_handling
def flex_error_handling
response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)
response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)
end
def rescue_action_in_public(exception)
render_exception(exception)
end
def rescue_action_locally(exception)
render_exception(exception)
end
rescue_from ActiveRecord::RecordNotFound, :with => :render_exception
def render_exception(exception)
render :text => "<errors><error>#{exception}</error></errors>", :status => 200
end
end
将 422 状态消息更改为 200 的操作是 Hillerman/Wanja 将 2032 Stream Error 更改为更友好的内容的原始建议的一部分,以便将无效记录错误发送回 Flex UI。
Try using a debug proxy to take a peek at the traffic, I like Charles.