Skip to content

Commit 689e6df

Browse files
committed
fix: api not found support.
1 parent a4964a0 commit 689e6df

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/dllama-api.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,13 @@ class HttpRequest {
185185
if (method == HttpMethod::METHOD_DELETE) return "DELETE";
186186
return "UNKNOWN";
187187
}
188-
188+
189189
void writeNotFound() {
190-
const char *data = "HTTP/1.1 404 Not Found\r\n";
191-
writeSocket(serverSocket, data, strlen(data));
190+
std::ostringstream buffer;
191+
buffer << "HTTP/1.1 404 Not Found\r\n"
192+
<< "Content-Length: 9\r\n\r\nNot Found";
193+
std::string data = buffer.str();
194+
writeSocket(serverSocket, data.c_str(), data.size());
192195
}
193196

194197
void writeJson(std::string json) {

0 commit comments

Comments
 (0)