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"
HTTP Request action allows you to upload files on a specified service.
The HTTP PUT request method is used to create a new resource or overwrite a representation of the target resource that is known by the client. Calling this method once is similar to calling it multiple times successively as it has the same effect. Though it is idempotent, we cannot cache its response.
One downside of GET requests is that they can only supply data in the form of parameters encoded in the URI (known as a Query String) or as cookies in the cookie request header. Therefore, GET cannot be used for uploading files or other operations that require large amounts of data to be sent to the server.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With