mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Fix HttpRequestResponseTrigger again (#4285)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> fixes https://github.com/esphome/issues/issues/4010
This commit is contained in:
parent
530df91044
commit
a19f0c0db0
4 changed files with 40 additions and 2 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -52,6 +52,10 @@ jobs:
|
||||||
file: tests/test6.yaml
|
file: tests/test6.yaml
|
||||||
name: Test tests/test6.yaml
|
name: Test tests/test6.yaml
|
||||||
pio_cache_key: test6
|
pio_cache_key: test6
|
||||||
|
- id: test
|
||||||
|
file: tests/test7.yaml
|
||||||
|
name: Test tests/test7.yaml
|
||||||
|
pio_cache_key: test7
|
||||||
- id: pytest
|
- id: pytest
|
||||||
name: Run pytest
|
name: Run pytest
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
|
|
|
@ -31,9 +31,9 @@ struct Header {
|
||||||
const char *value;
|
const char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HttpRequestResponseTrigger : public Trigger<int, uint32_t> {
|
class HttpRequestResponseTrigger : public Trigger<int32_t, uint32_t> {
|
||||||
public:
|
public:
|
||||||
void process(int status_code, uint32_t duration_ms) { this->trigger(status_code, duration_ms); }
|
void process(int32_t status_code, uint32_t duration_ms) { this->trigger(status_code, duration_ms); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class HttpRequestComponent : public Component {
|
class HttpRequestComponent : public Component {
|
||||||
|
|
|
@ -25,3 +25,4 @@ Current test_.yaml file contents.
|
||||||
| test4.yaml | ESP32 | ethernet | None
|
| test4.yaml | ESP32 | ethernet | None
|
||||||
| test5.yaml | ESP32 | wifi | ble_server
|
| test5.yaml | ESP32 | wifi | ble_server
|
||||||
| test6.yaml | RP2040 | wifi | N/A
|
| test6.yaml | RP2040 | wifi | N/A
|
||||||
|
| test7.yaml | ESP32-C3 | wifi | N/A
|
||||||
|
|
33
tests/test7.yaml
Normal file
33
tests/test7.yaml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Tests for ESP32-C3 boards which use toolchain-riscv32-esp
|
||||||
|
---
|
||||||
|
wifi:
|
||||||
|
ssid: 'ssid'
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: 'on-response-test'
|
||||||
|
on_boot:
|
||||||
|
then:
|
||||||
|
- http_request.send:
|
||||||
|
method: PUT
|
||||||
|
url: https://esphome.io
|
||||||
|
headers:
|
||||||
|
Content-Type: application/json
|
||||||
|
body: Some data
|
||||||
|
verify_ssl: false
|
||||||
|
on_response:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "Response status: %d"
|
||||||
|
args:
|
||||||
|
- status_code
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
http_request:
|
||||||
|
useragent: esphome/tagreader
|
||||||
|
timeout: 10s
|
Loading…
Reference in a new issue