Posting xml in functional test


#1

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


#2

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.