基于 XML 的 RESTful API [英] XML-based RESTful API

查看:39
本文介绍了基于 XML 的 RESTful API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 rails g scaffold 创建了一个基本的 RESTful 服务,但它无法接受 ActiveResource 发送的 XML 请求(适用于 JSON POST 请求和 XML GET 请求).它因 ActionController::ParameterMissing 而失败,所以很明显它与白名单有关,但我不知道我应该发送什么.有什么建议吗?

I've created a basic RESTful service with rails g scaffold and it fails to accept XML request sent by ActiveResource (works fine with JSON POST requests and XML GET requests). It fails with ActionController::ParameterMissing so obviously it has something to do with whitelisting but I can't figure out what exactly I should send. Any suggestions?

推荐答案

似乎在 Rails 4 中移除了 XML 支持,因此需要 actionpack-xml_parser gem 来处理 XML 请求.

It seems that XML support was removed in Rails 4 so actionpack-xml_parser gem is required to deal with XML requests.

这篇关于基于 XML 的 RESTful API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆