api: allow to use path helper without api enabled

This commit is contained in:
Maxim Prokhorov
2021-03-02 18:04:21 +03:00
parent 39c08fc1e5
commit 4854f91b3d
4 changed files with 110 additions and 93 deletions

View File

@@ -1,8 +1,9 @@
/*
API MODULE
API & WEB API MODULE
Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
Copyright (C) 2020-2021 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
*/
@@ -10,16 +11,17 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if API_SUPPORT
#include "system.h"
#include "web.h"
#include "rpc.h"
#if WEB_SUPPORT
#include "web.h"
#include <ESPAsyncTCP.h>
#include <ArduinoJson.h>
#endif
#include <algorithm>
#include <memory>
#include <cstring>
#include <forward_list>
#include <vector>
@@ -230,6 +232,8 @@ size_t ApiRequest::wildcards() const {
// -----------------------------------------------------------------------------
#if API_SUPPORT
bool _apiAccepts(AsyncWebServerRequest* request, const __FlashStringHelper* str) {
auto* header = request->getHeader(F("Accept"));
if (header) {