Test file upload using HTTP PUT method

I've written a service using HTTP PUT method for uploading a file.

Web Browsers don't support PUT so I need a method for testing. It works great as a POST hitting it from a browser.

update : This is what worked. I tried Poster but it suffers from the same thing as using fiddler. You have to know how to build the request. curl takes care of the problem.

curl -X PUT "localhost:8080/urlstuffhere" -F "file=@filename" -b "JSESSIONID=cookievalue"


In my opinion the best tool for such testing is curl . Its --upload-file option uploads a file by PUT, which is exactly what you want (and it can do much more, like modifying HTTP headers, in case you need it):

curl http://myservice --upload-file file.txt

curl -X PUT -T "/path/to/file" "http://myputserver.com/puturl.tmp" 

For curl , how about using the -d switch? Like: curl -X PUT "localhost:8080/urlstuffhere" -d "@filename" ?

链接地址: http://www.djcxy.com/p/41114.html

上一篇: 为什么现代浏览器不支持PUT和DELETE表单方法?

下一篇: 使用HTTP PUT方法测试文件上传