Http:delete(uri, content)method
Send an asynchronous DELETE request to the connected HTTP server to delete the specified resource on the server.
Parameters
uri
A stringrepresenting the target resource on the server to delete.
content
A File or any value converted to a string representing the body content of the request.
Return value
This method return a Task instance. Once the Task has finished, it will return two values :
- The first value is the Http instance used for the PUT request.
- The second value is
nilin case of error or atablethat contains the server response, with the following fields "content": astringcontaining the body part of the HTTP response"elapsed": anumberrepresenting the elapsed time to get the response"status": anumbercontaining the HTTP response status"reason": astringcontaining HTTP response status text"ok": abooleanvalue indicating if the GET request succeeded"headers": atablecontaining a pair ofstrings(header field names of the HTTP response as key and content as values)"cookies": atablecontaining a pair ofstrings(cookies names of the HTTP response as key and content as values)
Example
--! luart-extensions
import net
local client = net.Http("https://httpbun.com")
-- make a DELETE request, and once its terminated, call the provided function, to process the response
client:delete("/delete", data).after = function (self, response)
if not response then
error(net.error)
end
print(response.content)
end
waitall()