-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathjson.h
More file actions
19 lines (13 loc) · 712 Bytes
/
Copy pathjson.h
File metadata and controls
19 lines (13 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once
#include <WebServer.h>
void httpSendJson(WebServer& server, int code, const char* body);
void httpSendHtml(WebServer& server, int code, const char* body);
void httpSendCorsPreflight(WebServer& server);
// Returns false and sends 401 when access token is configured and missing/wrong.
bool httpRequireApiAuth(WebServer& server);
// Returns false and sends 503 when WiFi credentials are not saved yet.
bool httpRequireWifiConfigured(WebServer& server);
// WiFi configured + auth, then call handler.
void httpWithWifiAndApiAuth(WebServer& server, void (*handler)(WebServer&));
// Auth, then call handler. No-op if auth fails.
void httpWithApiAuth(WebServer& server, void (*handler)(WebServer&));