MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / SendHttpBadRequest

Method SendHttpBadRequest

cpp/webdriver-server/server.cc:558–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556}
557
558void Server::SendHttpBadRequest(struct mg_connection* const connection,
559 const struct mg_request_info* request_info,
560 const std::string& body) {
561 LOG(TRACE) << "Entering Server::SendHttpBadRequest";
562
563 std::string body_to_send = body + "\r\n";
564
565 std::ostringstream out;
566 out << "HTTP/1.1 400 Bad Request\r\n"
567 << "Content-Length: " << strlen(body_to_send.c_str()) << "\r\n"
568 << "Content-Type: application/json; charset=utf-8\r\n"
569 << "Cache-Control: no-cache\r\n"
570 << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n"
571 << "Accept-Ranges: bytes\r\n\r\n";
572 if (strcmp(request_info->request_method, "HEAD") != 0) {
573 out << body_to_send;
574 }
575
576 mg_printf(connection, "%s", out.str().c_str());
577}
578
579void Server::SendHttpInternalError(struct mg_connection* connection,
580 const struct mg_request_info* request_info,

Callers 1

SendResponseToClientMethod · 0.95

Calls 1

LOGClass · 0.70

Tested by

no test coverage detected