I have a hard time using lua socket
generic POST. I\'m trying to POST to a web along with a body. But the body output i got is 1. Here\'s my code
http.request
has two forms, The simple form downloads a URL using the GET or POST method and is based on strings.
http.request(url [, body])
The generic form performs any HTTP method and is LTN12 based.
http.request{
url = string,
[sink = LTN12 sink,]
[method = string,]
[headers = header-table,]
[source = LTN12 source],
[step = LTN12 pump step,]
[proxy = string,]
[redirect = boolean,]
[create = function]
}
You are using the generic form, and according to the document, the first return value is supposed to be 1.
In case of failure, the function returns nil followed by an error message. If successful, the simple form returns the response body as a string, followed by the response status code, the response headers and the response status line. The generic function returns the same information, except the first return value is just the number 1 (the body goes to the sink).