mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 11:56:25 +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
@ -115,8 +115,11 @@ void HttpRequestComponent::close() {
|
||||
}
|
||||
|
||||
const char *HttpRequestComponent::get_string() {
|
||||
static const String STR = this->client_.getString();
|
||||
return STR.c_str();
|
||||
// The static variable is here because HTTPClient::getString() returns a String on ESP32, and we need something to
|
||||
// to keep a buffer alive.
|
||||
static std::string str;
|
||||
str = this->client_.getString().c_str();
|
||||
return str.c_str();
|
||||
}
|
||||
|
||||
} // namespace http_request
|
||||
|
Loading…
Reference in New Issue
Block a user