Skip to content

check post vars too on post requests#229

Open
dbursem wants to merge 2 commits intoserkri:masterfrom
dbursem:check-post-vars-on-api-calls-2
Open

check post vars too on post requests#229
dbursem wants to merge 2 commits intoserkri:masterfrom
dbursem:check-post-vars-on-api-calls-2

Conversation

@dbursem
Copy link
Copy Markdown

@dbursem dbursem commented Dec 20, 2023

fixes #220

e.g.:

➜  SmartEVSE-3 git:(check-post-vars-on-api-calls-2) curl -v -d 'L1=11' -d 'L2=12' -d 'L3=13' -d 'battery_current=5' http://192.168.1.225/currents
*   Trying 192.168.1.225:80...
* Connected to 192.168.1.225 (192.168.1.225) port 80 (#0)
> POST /currents HTTP/1.1
> Host: 192.168.1.225
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 35
> Content-Type: application/x-www-form-urlencoded
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 93
< Content-Type: application/json
< Connection: close
< Accept-Ranges: none
< 
* Closing connection 0
{"battery_current":5,"original":{"L":11,"":12,"SMART":13},"L":11,"":12,"SMART":13,"TOTAL":36}

old behaviour also still works:

➜  SmartEVSE-3 git:(check-post-vars-on-api-calls-2) curl -v -X POST http://192.168.1.225/currents\?L1\=21\&L2\=22\&L3\=23                                
*   Trying 192.168.1.225:80...
* Connected to 192.168.1.225 (192.168.1.225) port 80 (#0)
> POST /currents?L1=21&L2=22&L3=23 HTTP/1.1
> Host: 192.168.1.225
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 73
< Content-Type: application/json
< Connection: close
< Accept-Ranges: none
< 
* Closing connection 0
{"original":{"L":21,"":22,"SMART":23},"L":21,"":22,"SMART":23,"TOTAL":66}%                                                                                                          ➜  SmartEVSE-3 git:(check-post-vars-on-api-calls-2) 

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

Successfully merging this pull request may close these issues.

POST body not parsed on POST requests

1 participant