headers: add csrf (#35)
This commit is contained in:
24
src/headers/csrfHeader.hpp
Normal file
24
src/headers/csrfHeader.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <pistache/http_headers.h>
|
||||
#include <pistache/net.h>
|
||||
|
||||
class XCSRFTokenHeader : public Pistache::Http::Header::Header {
|
||||
public:
|
||||
NAME("X-Csrf-Token");
|
||||
|
||||
XCSRFTokenHeader() = default;
|
||||
|
||||
void parse(const std::string& str) override {
|
||||
m_data = str;
|
||||
}
|
||||
|
||||
void write(std::ostream& os) const override {
|
||||
os << m_data;
|
||||
}
|
||||
|
||||
std::string ip() const {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_data = "";
|
||||
};
|
||||
Reference in New Issue
Block a user