1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +00:00

WebDriver: Implement POST /session/{id}/forward endpoint

This commit is contained in:
Moustafa Raafat 2022-10-15 18:18:35 +01:00 committed by Linus Groh
parent 9132656856
commit a4fa604bde
7 changed files with 46 additions and 0 deletions

View file

@ -28,6 +28,7 @@ Vector<Client::Route> Client::s_routes = {
{ HTTP::HttpRequest::Method::DELETE, { "session", ":session_id", "window" }, &Client::handle_delete_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "refresh" }, &Client::handle_refresh },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "back" }, &Client::handle_back },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "forward" }, &Client::handle_forward },
};
Client::Client(NonnullOwnPtr<Core::Stream::BufferedTCPSocket> socket, Core::Object* parent)
@ -475,4 +476,15 @@ ErrorOr<JsonValue, HttpError> Client::handle_back(Vector<StringView> parameters,
return make_json_value(result);
}
// POST /session/{session id}/forward https://w3c.github.io/webdriver/#dfn-forward
ErrorOr<JsonValue, HttpError> Client::handle_forward(Vector<StringView> parameters, JsonValue const&)
{
dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session/<session_id>/forward");
Session* session = TRY(find_session_with_id(parameters[0]));
// NOTE: Spec steps handled in Session::forward().
auto result = TRY(session->forward());
return make_json_value(result);
}
}