Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
BPrivate::Network::BHttpStatus Struct Reference

Represents the HTTP status code and status text of an incoming response. More...

Public Member Functions

BHttpStatusClass StatusClass () const noexcept
 Map the code value to a BHttpStatusClass value.
 
BHttpStatusCode StatusCode () const noexcept
 Map the code value to a BHttpStatusCode value.
 

Public Attributes

int16 code = 0
 The three digit status code.
 
BString text
 A textual representation of the result status.
 

Detailed Description

Represents the HTTP status code and status text of an incoming response.

The HTTP Standard specifies that each response should include a three digit status code and a phrase that describes the status code. When processing the response status, you should ignore the textual representation and only look at the status code.

Instances of this class provide a representation of the actual status information in the response. There is no additional validation done, other than that the structure of the status line is in compliance with the HTTP specification.

Since
Haiku R1

Member Function Documentation

◆ StatusClass()

BHttpStatusClass BPrivate::Network::BHttpStatus::StatusClass ( ) const
noexcept

Map the code value to a BHttpStatusClass value.

Returns
One of the valid values of BHttpStatusClass, or BHttpStatusClass::Invalid if the return code cannot be maped.
Since
Haiku R1

◆ StatusCode()

BHttpStatusCode BPrivate::Network::BHttpStatus::StatusCode ( ) const
noexcept

Map the code value to a BHttpStatusCode value.

Returns
One of the valid values of BHttpStatusCode, or BHttpStatusCode::Unknown if the return code cannot be maped.
Since
Haiku R1

Member Data Documentation

◆ code

int16 BPrivate::Network::BHttpStatus::code = 0

The three digit status code.

This code represents the result of how the server is processing or has processed a request. Common codes are 200 indicating success, or 404 indicating that the requested resource is not found.

See RFC7231 and its references for more information.

Since
Haiku R1

◆ text

BString BPrivate::Network::BHttpStatus::text

A textual representation of the result status.

As defined in the specification, the status text should only be taken as informative. Only the BHttpStatus::code should be used for further processing.

Since
Haiku R1