#pragma once #include #include "config.h" class HTTPClientWrapper { private: HTTPClient* _http; uint8_t* _buffer; uint16_t _buffer_size; uint16_t _buffer_length; uint16_t _buffer_position; uint32_t _chunk_length; bool _connected = false; String _content_type; uint32_t _length; bool _request(String method, String url, uint32_t offset=0, uint8_t redirection_count=0); WiFiClient* _stream; bool _is_chunked; void _read_next_chunk_header(bool first); uint16_t _fill_buffer(); public: HTTPClientWrapper(); ~HTTPClientWrapper(); bool get(String url, uint32_t offset=0, uint8_t redirection_count=0); bool head(String url, uint32_t offset=0, uint8_t redirection_count=0); String getContentType(); String getString(); int read(); uint32_t read(uint8_t* dst, uint32_t len); void close(); uint32_t getSize(); String readUntil(String sep); String readLine(); int peek(int offset=0); };