magpie
Loading...
Searching...
No Matches
magpie::Response Struct Reference
Inheritance diagram for magpie::Response:
Collaboration diagram for magpie::Response:

Public Member Functions

 Response (const StatusCode &code, std::string &&body, std::string &&contentType="text/plain")
 Response (const StatusCode &code, std::shared_ptr< DataAdapter > &&bodyAdapter, std::string &&contentType)
 Response (Response &&)=delete
 Response (Response &)=delete
void setBody (std::string &&body)
Response & operator= (Response &&other)=default
Response & operator= (CompressedResponse &&other)

Static Public Member Functions

static void redirect (Response &out, std::string &&dest, bool permanent=false)
static void moved (Response &out, std::string &&dest)

Public Attributes

std::unordered_map< std::string, std::string > headers
const StatusCodecode
std::shared_ptr< DataAdapterbody
std::string contentType = "text/plain"

Member Function Documentation

◆ moved()

void magpie::Response::moved ( Response & out,
std::string && dest )
static

Creates a Response object for redirecting to another target. This function specifically sends MovedPermanently instead of PermanentRedirect or TemporaryRedirect, like Response::redirect does

Warning
There is no validation on dest, so user-generated redirects may end up malicious. Ways to sanitise the URIs is a future feature.
Parameters
out[out]The request object to modify
destThe destination to redirect to.

◆ redirect()

void magpie::Response::redirect ( Response & out,
std::string && dest,
bool permanent = false )
static

Creates a Response object for redirecting to another target.

Warning
There is no validation on dest, so user-generated redirects may end up malicious. Ways to sanitise the URIs is a future feature.
Parameters
out[out]The request object to modify
destThe destination to redirect to.
permanentWhether or not the redirect is permanent

Member Data Documentation

◆ headers

std::unordered_map<std::string, std::string> magpie::Response::headers

The response headers.


The documentation for this struct was generated from the following files:
  • src/magpie/transfer/Response.hpp
  • src/magpie/transfer/Response.cpp