Here's an example of how to make an HTTP DELETE
request using the Ruby net/http
library:
main.rb271 chars14 lines
In this example, you first create a URI
object to represent the URL of the resource to delete. Then, you create a new Net::HTTP::Delete
object, passing in the path portion of the URL as the argument.
You can set any additional headers you need on the request object using the hash-like []=
operator syntax, as shown with the User-Agent
header.
Next, you use Net::HTTP.start
to establish a connection to the server and send the request. Finally, you can inspect the body of the response.
gistlibby LogSnag