mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 02:04:13 +01:00
Fix HTTPRequestComponent::get_string return value (#2987)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
parent
f849d45bb6
commit
dce3713f12
1 changed files with 5 additions and 2 deletions
|
@ -115,8 +115,11 @@ void HttpRequestComponent::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *HttpRequestComponent::get_string() {
|
const char *HttpRequestComponent::get_string() {
|
||||||
static const String STR = this->client_.getString();
|
// The static variable is here because HTTPClient::getString() returns a String on ESP32, and we need something to
|
||||||
return STR.c_str();
|
// to keep a buffer alive.
|
||||||
|
static std::string str;
|
||||||
|
str = this->client_.getString().c_str();
|
||||||
|
return str.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace http_request
|
} // namespace http_request
|
||||||
|
|
Loading…
Reference in a new issue