# Posting xml in functional test

**URL:** <https://www.ruby-forum.com/t/posting-xml-in-functional-test/59751>\
**Category:** Rails\
**Created:** [May 6, 2006, 12:58am UTC](https://www.ruby-forum.com/t/posting-xml-in-functional-test/59751 "2006-05-06T00:58:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin\_worrall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/90ced4/32.png) [@justin\_worrall](https://www.ruby-forum.com/u/justin_worrall)\
**Post date:** [May 6, 2006, 12:58am UTC](https://www.ruby-forum.com/t/posting-xml-in-functional-test/59751/1 "2006-05-06T00:58:07Z")

</div>

Hello,

I’m trying to write a functional test for a simple CRUD controller which  
accepts / emits xml in a REST- like fashion. However the following code  
won’t work for me - an exception is generated

def test\_create  
post :create, ‘john’,  
{‘Content-Type’=\>‘application/xml’}  
assert\_response 200  
end

Anyone give me a hint where I’m going wrong ?

thanks in advance

---

<div class="post-metadata">

**Author:** ![justin\_worrall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/90ced4/32.png) [@justin\_worrall](https://www.ruby-forum.com/u/justin_worrall)\
**Post date:** [May 6, 2006, 1:54am UTC](https://www.ruby-forum.com/t/posting-xml-in-functional-test/59751/2 "2006-05-06T01:54:49Z")

</div>

justin worrall wrote:

> Hello,
> 
> I’m trying to write a functional test for a simple CRUD controller which  
> accepts / emits xml in a REST- like fashion. However the following code  
> won’t work for me - an exception is generated
> 
> def test\_create  
> post :create, ‘john’,  
> {‘Content-Type’=\>‘application/xml’}  
> assert\_response 200  
> end
> 
> Anyone give me a hint where I’m going wrong ?
> 
> thanks in advance

I’m not sure how to fix it but I believe you stuck that xml in the post  
query string, not the post body.

And if “an exception is generated” then it would be good to knwo the  
details of said exception.
