Method HttpClient():setMethod() Foundation

Sets the request method.

METHOD :setMethod( <cMethod> ) --> self
A character string specifying the request method. The following table lists some of the request methods which are most commonly used.
Request methods
Method Description
GET Requests the specified resource. Requests using GET should only retrieve data.
HEAD Asks for a response identical to that of a GET request, but without the response body. Can be used to gather information upfront.
POST Submits an entity to the specified resource, which often causes a change in state or side effects on the server.
PUT Replaces all representations of the specified resource with the request payload.
DELETE Deletes the specified resource.
CONNECT Establishes a tunnel to the specified server.
OPTIONS Describes the communication options for the target resource.
TRACE Performs a message loop-back test along the path to the specified resource.
PATCH Applies partial modifications to the specified resource.

:setMethod() returns the object executing the method.


The method :setMethod() sets the request method for subsequent requests. The request method indicates the desired action to be performed for a resource. Request methods are sometimes also referred to as HTTP verbs.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.