MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / methodPost

Method methodPost

src/HttpServer.cpp:78–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool HttpServer::methodPost(SocketClient &client) {
79 const std::string content = StringConverter::getContentFrom(client.getMessage());
80 if (!content.empty()) {
81 const std::string file = StringConverter::getRequestedFile(client.getMessage());
82 if (file == "/SatPI.xml") {
83 _xml.fromXML(content);
84 }
85 }
86 // setup reply
87 std::string htmlBody;
88 getHtmlBodyWithContent(htmlBody, HTML_NO_RESPONSE, "", CONTENT_TYPE_HTML, 0, 0);
89
90 // send 'htmlBody' to client
91 if (!client.sendData(htmlBody.c_str(), htmlBody.size(), 0)) {
92 SI_LOG_ERROR("Send htmlBody failed");
93 return false;
94 }
95 return true;
96}
97
98bool HttpServer::methodGet(SocketClient &client) {
99 std::string htmlBody;

Callers

nothing calls this directly

Calls 3

getMessageMethod · 0.80
fromXMLMethod · 0.80
sendDataMethod · 0.80

Tested by

no test coverage detected