[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Haproxy-LUA-RestAPI call
- From: Sean Conner <sean@...>
- Date: Thu, 12 Mar 2020 11:43:22 -0400
It was thus said that the Great murali once stated:
> Hi Team,
>
> I am trying to send Http-POST request, but getting the response as
>
> *<html><body><h1>400 Bad request</h1>Your browser sent an invalid
> request.</body></html>*
>
> Here, providing the Http-POST request, please help us with anything wrong
> in request forming.
>
> *local payload = [[{"email":"evtest@yopmail.com <evtest@yopmail.com>"}]]
> local hdrs = { [1] = string.format('host: %s:%s', addr,port),
> [2] = 'Accept: */*', [3] = 'Content-Type: application/json',
> [4] = string.format('Content-Length: %d',#payload) }*
>
> * local req = { [1] = 'POST /evl/evIDLookUp HTTP/1.1', [2] =
> table.concat(hdrs, '\r\n'), [3] = '\r\n', [4] = payload }
> req = table.concat(req, '\r\n')*
Have you tried printing req to see what it looks like? You may also want
to carefully read RFC-2616 which describes the HTTP protocol (hint: section
4.1 applies here).
-spc