| 176 | } |
| 177 | |
| 178 | bool receiveBody(httpd_req_t *req, String &body, size_t maxSize = 8192) { |
| 179 | if (req->content_len > maxSize) return false; |
| 180 | body = ""; |
| 181 | body.reserve(req->content_len + 1); |
| 182 | size_t remaining = req->content_len; |
| 183 | while (remaining > 0) { |
| 184 | int readLen = |
| 185 | httpd_req_recv(req, reinterpret_cast<char *>(buff), remaining > bufSize ? bufSize : remaining); |
| 186 | if (readLen <= 0) return false; |
| 187 | body.concat(reinterpret_cast<const char *>(buff), readLen); |
| 188 | remaining -= readLen; |
| 189 | } |
| 190 | return true; |
| 191 | } |
| 192 | |
| 193 | String multipartBoundary(const String &contentType) { |
| 194 | int idx = contentType.indexOf("boundary="); |
no outgoing calls
no test coverage detected