Using multipart/form-data when calling 'post' in tests

Hi,
Has anyone used ActionController::Integration::Session#post in their
integration tests to post multipart/form-data encoded parameters?
eg
    my_session.post url , encoded_string , headers
where 'headers' includes the content-type and content-length.

Is there a library which will help generate this encoded string in ruby?
eg Net::HTTP::Post or something in rails?

I've started looking at RFC 2046, and various fragments people have
posted in the past - but I live in hope.

Regards,
Daniel

Daniel Bush wrote:

Hi,
Has anyone used ActionController::Integration::Session#post in their
integration tests to post multipart/form-data encoded parameters?
eg
    my_session.post url , encoded_string , headers
where 'headers' includes the content-type and content-length.

Is there a library which will help generate this encoded string in ruby?
eg Net::HTTP::Post or something in rails?

I've started looking at RFC 2046, and various fragments people have
posted in the past - but I live in hope.

Regards,
Daniel

Ok, to answer my own post in part:
If you're going to write your own multipart/form-data encoding routine,
then remember these 2 things:
1) prepend the boundary string with 2 dashes '--' when using it
2) don't forget to append 2 dashes on the end of the last boundary

May as well post what I did:

In an integration test: