SFML 2.5.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends | List of all members
sf::Http::Response Class Reference

Define a HTTP response. More...

`#include <Http.hpp>`

## Public Types

enum

Status {
Ok = 200, Created = 201, Accepted = 202, NoContent = 204,
ResetContent = 205, PartialContent = 206, MultipleChoices = 300, MovedPermanently = 301,
MovedTemporarily = 302, NotModified = 304, BadRequest = 400, Unauthorized = 401,
Forbidden = 403, NotFound = 404, RangeNotSatisfiable = 407, InternalServerError = 500,
NotImplemented = 501, BadGateway = 502, ServiceNotAvailable = 503, GatewayTimeout = 504,
VersionNotSupported = 505, InvalidResponse = 1000, ConnectionFailed = 1001
}

| Enumerate all the valid status codes for a response. More...

## Public Member Functions

| Response ()
| Default constructor. More...
const std::string & | getField (const std::string &field) const
| Get the value of a field. More...
Status | getStatus () const
| Get the response status code. More...
unsigned int | getMajorHttpVersion () const
| Get the major HTTP version number of the response. More...
unsigned int | getMinorHttpVersion () const
| Get the minor HTTP version number of the response. More...
const std::string & | getBody () const
| Get the body of the response. More...

## Friends

class | Http

## Detailed Description

Define a HTTP response.

Definition at line 193 of file Http.hpp.

## Member Enumeration Documentation

## ◆ Status

enum sf::Http::Response::Status

Enumerate all the valid status codes for a response.

Enumerator
Ok | Most common code returned when operation was successful.
Created | The resource has successfully been created.
Accepted | The request has been accepted, but will be processed later by the server.
NoContent | The server didn't send any data in return.
ResetContent | The server informs the client that it should clear the view (form) that caused the request to be sent.
PartialContent | The server has sent a part of the resource, as a response to a partial GET request.
MultipleChoices | The requested page can be accessed from several locations.
MovedPermanently | The requested page has permanently moved to a new location.
MovedTemporarily | The requested page has temporarily moved to a new location.
NotModified | For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed.
BadRequest | The server couldn't understand the request (syntax error)
Unauthorized | The requested page needs an authentication to be accessed.
Forbidden | The requested page cannot be accessed at all, even with authentication.
NotFound | The requested page doesn't exist.
RangeNotSatisfiable | The server can't satisfy the partial GET request (with a "Range" header field)
InternalServerError | The server encountered an unexpected error.
NotImplemented | The server doesn't implement a requested feature.
BadGateway | The gateway server has received an error from the source server.
ServiceNotAvailable | The server is temporarily unavailable (overloaded, in maintenance, ...)
GatewayTimeout | The gateway server couldn't receive a response from the source server.
VersionNotSupported | The server doesn't support the requested HTTP version.
InvalidResponse | Response is not a valid HTTP one.
ConnectionFailed | Connection with server failed.

Definition at line 201 of file Http.hpp.

## Constructor & Destructor Documentation

## ◆ Response()

sf::Http::Response::Response | ( |  | ) |

Default constructor.

Constructs an empty response.

## Member Function Documentation

## ◆ getBody()

const std::string& sf::Http::Response::getBody | ( |  | ) | const

Get the body of the response.

The body of a response may contain:

- the requested page (for GET requests)
- a response from the server (for POST requests)
- nothing (for HEAD requests)
- an error message (in case of an error)

Returns
  The response body

## ◆ getField()

const std::string& sf::Http::Response::getField | ( | const std::string & | field | ) | const

Get the value of a field.

If the field field is not found in the response header, the empty string is returned. This function uses case-insensitive comparisons.

Parameters

  field | Name of the field to get

Returns
  Value of the field, or empty string if not found

## ◆ getMajorHttpVersion()

unsigned int sf::Http::Response::getMajorHttpVersion | ( |  | ) | const

Get the major HTTP version number of the response.

Returns
  Major HTTP version number

See also
  getMinorHttpVersion

## ◆ getMinorHttpVersion()

unsigned int sf::Http::Response::getMinorHttpVersion | ( |  | ) | const

Get the minor HTTP version number of the response.

Returns
  Minor HTTP version number

See also
  getMajorHttpVersion

## ◆ getStatus()

Status sf::Http::Response::getStatus | ( |  | ) | const

Get the response status code.

The status code should be the first thing to be checked after receiving a response, it defines whether it is a success, a failure or anything else (see the Status enumeration).

Returns
  Status code of the response

The documentation for this class was generated from the following file:

- Http.hpp