Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add access to httprequest body #143

Closed
alon24 opened this issue Jun 28, 2015 · 5 comments
Closed

Add access to httprequest body #143

alon24 opened this issue Jun 28, 2015 · 5 comments

Comments

@alon24
Copy link

alon24 commented Jun 28, 2015

I want to use json with web, and send data from webpage (supplied by esp) to the server (esp server), using ajax.

I want to use AJAX to trigger a command on the server and use JSON to tell its params and data.
There is no way on the server side to reach the body of the request and parse the JSON payload.

For instance, have a button to toggle a relay (from web) and return the current state in the response.

@alon24
Copy link
Author

alon24 commented Jun 29, 2015

Hi,

The fact that I do not know how, and I asked in gitter and they said it
needs to be added, so like a good sport I opened a bug request (did not
know how to set it as feature request).

On Mon, Jun 29, 2015 at 12:43 AM, Dmitry Kireev [email protected]
wrote:

@alon24 https://github.com/alon24 What stops you from doing it right
now?


Reply to this email directly or view it on GitHub
#143 (comment).

@alon24
Copy link
Author

alon24 commented Jul 13, 2015

is there a way to access the body?

@dereulenspiegel
Copy link

I have the exact same problem. Parsing the body as POST request parameters is not always useful. What would be the preferred way of solving this in Sming? We could for example not parse the body by default, but supply method on the request object which parses the body if needed. Or we keep a copy of the body around. But that doesn't sound very efficient.

@dereulenspiegel
Copy link

Just for information: I implemented a first attemp to solve this problem (see here https://github.com/dereulenspiegel/Sming/tree/http-body). I will create a pull request from this, since it shouldn't break anything.

@hreintke
Copy link
Contributor

Working on a solution in PR #487.
Please continue discussion there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants