Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::testing::Response Struct Reference

What the application answered, as a test sees it. More...

#include <Client.hpp>

Public Member Functions

std::optional< std::string > header (std::string_view name) const
 A header, by case-insensitive name.
 
nlohmann::json json () const
 The body parsed as JSON (null if it is not JSON).
 

Public Attributes

int status = 0
 
std::map< std::string, std::string > headers
 Header names as the application set them; look them up with header().
 
std::string body
 The whole body: the response body, or every chunk of a streamed one.
 
std::vector< std::string > chunks
 A streamed response's chunks (write_chunk() and SSE events), in order.
 
std::vector< http::Cookie > cookies
 
bool complete = false
 

Detailed Description

What the application answered, as a test sees it.

Member Function Documentation

◆ header()

std::optional< std::string > orbit::testing::Response::header ( std::string_view  name) const

A header, by case-insensitive name.

◆ json()

nlohmann::json orbit::testing::Response::json ( ) const

The body parsed as JSON (null if it is not JSON).

Member Data Documentation

◆ body

std::string orbit::testing::Response::body

The whole body: the response body, or every chunk of a streamed one.

◆ chunks

std::vector<std::string> orbit::testing::Response::chunks

A streamed response's chunks (write_chunk() and SSE events), in order.

◆ complete

bool orbit::testing::Response::complete = false

False if send()'s timeout passed first; a streamed response that has not called end() is incomplete, with what it sent so far.

◆ cookies

std::vector<http::Cookie> orbit::testing::Response::cookies

Set-Cookie entries

◆ headers

std::map<std::string, std::string> orbit::testing::Response::headers

Header names as the application set them; look them up with header().

◆ status

int orbit::testing::Response::status = 0

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