I want to send a HTTP POST request with Content-Type : Multipart/mixed using FitNesse . I need a solution only using Fitnesse Tool http://fitnesse.org/ as it is required for my project. Any help/guidance would be great.
2 回答
Just wrote a fitnesse fixture for multipart mixed content types.
The already existing smartrics rest fixtures can handle only multipart/form-data NOT multipart/mixed
.
It is also strange that the Httpcomponent 3.2 does not support multipart/mixed, but only multipart/form-data. Worse enough, I see no documentation that it does not support multipart/mixed. It is only on going through the source code, that I could see that the 'multipart/form-data' content type is hard-coded all over the place.
My fixture is written using :
Http component 4.3 : I have added additional support for multipart/mixed, apart from the already existing multipart/form-data
.Smartrics rest fixutre 3.0 : Extended the already existing restfixture class and the partfactory class to support multipart/mixed
.
Download the fixture from : https://code.google.com/p/multipart-rest-fitnesse-fixture/
Sample fitnesse Request to illustrate the usage: http://geekoolympics.blogspot.in/2014/01/multipart-fitnesse-fixture-for-restful.html
FitNesse 本身无法为所欲为。您将需要一个夹具来完成分段上传的工作。
您可以查看https://github.com/smartrics/RestFixture/wiki看看它是否符合您的需求。
如果没有,您将不得不编写自己的夹具类。HttpClient 是一个非常强大且可用的类,可以用来构建这样的东西。不幸的是,我无法提供一个工作示例作为参考。