Skip to content

Commit

Permalink
Encode args in HTTP address instead of POST request
Browse files Browse the repository at this point in the history
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 💭
  • Loading branch information
benjaminaaron committed Nov 20, 2019
1 parent 51c8a54 commit ee158b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions HumiditySensor/HumiditySensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ void ping() {
HTTPClient http;

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

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

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

// Logging
if (httpCode == 200) {
Expand All @@ -181,13 +181,13 @@ void verifyClaim() {
HTTPClient http;

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

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

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

// Get the response payload
String payload = http.getString();
Expand Down

0 comments on commit ee158b9

Please sign in to comment.