Skip to content

Commit d736b83

Browse files
committed
Tested on ESP8266 architecture. Examples are commented.
1 parent 79f71e5 commit d736b83

File tree

6 files changed

+10
-3
lines changed

6 files changed

+10
-3
lines changed

examples/esp32/get/get.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ void setup() {
1313
options.method = "GET";
1414

1515
Response response = fetch("https://api.github.com/", options);
16-
16+
17+
// Printing response body as plain text.
1718
Serial.println();
1819
Serial.println(response.text());
1920
}

examples/esp32/post/post.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ void setup() {
1515

1616
Response response = fetch("https://api.grandeur.tech/auth/login/?apiKey=grandeurkywxmoy914080rxf9dh05n7e", options);
1717

18+
Serial.println(response)
19+
// Printing response.
1820
Serial.println(response);
21+
// Printing respons headers.
1922
Serial.printf("Connection Header: \"%s\"\n", response.headers.get("Content-Type").c_str());
2023
Serial.printf("Connection Header: \"%s\"\n", response.headers.get("Connection").c_str());
2124
}

examples/esp8266/get/get.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ void setup() {
1616

1717
Response response = fetch("https://api.github.com/", options);
1818

19+
// Printing response body as plain text.
1920
Serial.println();
2021
Serial.println(response.text());
2122
}

examples/esp8266/post/post.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ void setup() {
1717

1818
Response response = fetch("https://api.grandeur.tech/auth/login/?apiKey=grandeurkywxmoy914080rxf9dh05n7e", options);
1919

20+
// Printing response.
2021
Serial.println(response);
22+
// Printing respons headers.
2123
Serial.printf("Connection Header: \"%s\"\n", response.headers.get("Content-Type").c_str());
2224
Serial.printf("Connection Header: \"%s\"\n", response.headers.get("Connection").c_str());
2325
}

src/Fetch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ size_t Response::printTo(Print& p) const {
134134
}
135135

136136
RequestOptions::RequestOptions(): method("GET"), headers(Headers()), body(Body()),
137-
#ifdef ESP8266
137+
#if defined(ESP8266)
138138
fingerprint(""),
139139
#endif
140140
caCert("") {}

src/Fetch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class RequestOptions {
8080
String method;
8181
Headers headers;
8282
Body body;
83-
#ifdef EEP8266
83+
#if defined(ESP8266)
8484
String fingerprint;
8585
#endif
8686
String caCert;

0 commit comments

Comments
 (0)