Skip to content

Commit ee158b9

Browse files
committed
Encode args in HTTP address instead of POST request
Just because I know how to do access the args like that from the express server, maybe (probably?) it's actually better style to pass it as HTTP POST args 💭
1 parent 51c8a54 commit ee158b9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

HumiditySensor/HumiditySensor.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ void ping() {
155155
HTTPClient http;
156156

157157
// Specify Ping destination
158-
http.begin(pingAddress);
158+
http.begin(pingAddress + String("?id=PlantWateringSensor&data=ThePlantSaysThanksForWatering"));
159159

160160
// Specify Content type and authenticate as Oracle
161161
http.addHeader("Content-Type", "application/json");
162162

163163
// Send Request and receive http Code
164-
int httpCode = http.POST(String("{\"accessToken\": \"") + accessToken + String("\"}"));
164+
int httpCode = http.POST(""); //String("{\"accessToken\": \"") + accessToken + String("\"}"));
165165

166166
// Logging
167167
if (httpCode == 200) {
@@ -181,13 +181,13 @@ void verifyClaim() {
181181
HTTPClient http;
182182

183183
// Specify request destination
184-
http.begin(verificationAddress);
184+
http.begin(verificationAddress + String("?id=PlantWateringSensor&data=ThePlantSaysThanksForWatering"));
185185

186186
// Specify content-type header and "log in" as Oracle
187187
http.addHeader("Content-Type", "application/json");
188188

189189
// Actually send the request
190-
int httpCode = http.POST(String("{\"isAccepted\": true, \"accessToken\": \"") + accessToken + String("\"}"));
190+
int httpCode = http.POST("");//String("{\"isAccepted\": true, \"accessToken\": \"") + accessToken + String("\"}"));
191191

192192
// Get the response payload
193193
String payload = http.getString();

0 commit comments

Comments
 (0)