Cute   Learning Hub


  • HttpRequest
  • HttpRequest Class

    class Cute::Server::HttpRequest

    The Cute::Server::HttpRequest class represents the parsed HTTP requests sent by clients to the server. More...

    Header: #include <HttpRequest>

    Public Functions

    const QByteArray &body() const
    QByteArray header(const QByteArray &name) const
    int headerCount(const QByteArray &name) const
    QVector<QByteArray> headers(const QByteArray &name) const
    int headersCount() const
    const QByteArray &method() const
    const QUrl &url() const

    Detailed Description

    The Cute::Server::HttpRequest class represents the parsed HTTP requests sent by clients to the server.

    Member Function Documentation

    const QByteArray &HttpRequest::body() const

    Returns the body of the HTTP request.

    Returns the value of the header with name. If the HTTP request does not contain a header with name equal to name, an empty QByteArray is returned. If the request has many headers with the same name, the value returned is aleatory.

    See also headerCount and headers.

    int HttpRequest::headerCount(const QByteArray &name) const

    Returns the number of headers in the HTTP request having the name equal to name.

    QVector<QByteArray> HttpRequest::headers(const QByteArray &name) const

    Returns all values of headers named name. If the HTTP request does not contain a header named name, the returned vector is empty. Otherwise it contains the values from all the headers named name.

    See also header and headerCount.

    int HttpRequest::headersCount() const

    Returns the number of headers in the HTTP request.

    const QByteArray &HttpRequest::method() const

    Returns the HTTP request's method. The Cute server supports the DELETE, GET, POST, PATCH and PUT methods.

    const QUrl &HttpRequest::url() const

    Returns the HTTP request URL.