|
2 | 2 |
|
3 | 3 |
|
4 | 4 | SlicingDice::SlicingDice(String apiUserKey) {
|
5 |
| - host = "api.slicingdice.com"; |
6 |
| - port = 80; |
7 |
| - apiKey = apiUserKey; |
8 |
| - useProduction = true; |
| 5 | + construct(apiUserKey, "api.slicingdice.com", 80, true); |
9 | 6 | }
|
10 | 7 |
|
11 | 8 | SlicingDice::SlicingDice(String apiUserKey, const char* customHost) {
|
12 |
| - host = customHost; |
13 |
| - port = 80; |
14 |
| - apiKey = apiUserKey; |
15 |
| - useProduction = true; |
| 9 | + construct(apiUserKey, customHost, 80, true); |
16 | 10 | }
|
17 | 11 |
|
18 | 12 | SlicingDice::SlicingDice(String apiUserKey, const char* customHost, int customPort) {
|
19 |
| - host = customHost; |
20 |
| - port = customPort; |
21 |
| - apiKey = apiUserKey; |
22 |
| - useProduction = true; |
| 13 | + construct(apiUserKey, customHost, customPort, true); |
23 | 14 | }
|
24 | 15 |
|
25 | 16 | SlicingDice::SlicingDice(String apiUserKey, const char* customHost, int customPort, boolean production) {
|
| 17 | + construct(apiUserKey, customHost, customPort, production); |
| 18 | +} |
| 19 | + |
| 20 | +void SlicingDice::construct(String apiUserKey, const char* customHost, int customPort, boolean production) { |
26 | 21 | host = customHost;
|
27 | 22 | port = customPort;
|
28 | 23 | apiKey = apiUserKey;
|
@@ -56,7 +51,6 @@ void SlicingDice::makeRequest(const char* query){
|
56 | 51 | }
|
57 | 52 |
|
58 | 53 | client.println("POST /v1/" + testEndPoint + "index HTTP/1.1");
|
59 |
| - Serial.println("POST /v1/" + testEndPoint + "index HTTP/1.1"); |
60 | 54 | client.println(F("Content-Type: application/json"));
|
61 | 55 | String hostString = String(host);
|
62 | 56 | client.println("Host: " + hostString);
|
|
0 commit comments