AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Public Attributes | List of all members
painlessmesh::gateway::HttpRequestOutcome Struct Reference

The outcome of a gateway HTTP request, classified for the ack. More...

#include <gateway.hpp>

Public Attributes

bool success = false
 
uint16_t ackStatus = 0
 
bool transportError = false
 
bool unverifiedStatus = false
 
bool retryable = false
 
TSTRING reason
 

Detailed Description

The outcome of a gateway HTTP request, classified for the ack.

HTTPClient::GET()/POST() return an int with two distinct meanings: a positive value is an HTTP status code from the destination, while a negative value is one of the client's own transport errors (see HttpTransportError). Zero is not produced by either.

GatewayAckPackage::httpStatus is a uint16_t, so a negative code cannot be forwarded as-is. Transport errors are reported as httpStatus 0 with the cause in GatewayAckPackage::error, and whether the origin node may resend the request travels in GatewayAckPackage::retryable.

The library applies HTTP's meaning of a status and nothing else. Whether a particular service's reply means what the application wanted – a message really queued, a record really written – is the application's decision, made from the status and the response the result carries.

Member Data Documentation

◆ ackStatus

uint16_t painlessmesh::gateway::HttpRequestOutcome::ackStatus = 0

Value to place in GatewayAckPackage::httpStatus (0 for transport errors).

◆ reason

TSTRING painlessmesh::gateway::HttpRequestOutcome::reason

One-line summary of the response body, for the error an application reads; empty on success and when no body was read.

◆ retryable

bool painlessmesh::gateway::HttpRequestOutcome::retryable = false

Whether resending the identical request is safe and useful: the request cannot have reached the server, or the server said it did not take it and to come back (429 Too Many Requests, 503 Service Unavailable). A reply that may mean the request was processed – any 2xx, a 500, a gateway timeout, a read timeout – is not retried, because a retry would be a second copy of it.

◆ success

bool painlessmesh::gateway::HttpRequestOutcome::success = false

True only for 200, 201, 202 and 204.

◆ transportError

bool painlessmesh::gateway::HttpRequestOutcome::transportError = false

True when the client failed before any HTTP status was received.

◆ unverifiedStatus

bool painlessmesh::gateway::HttpRequestOutcome::unverifiedStatus = false

True for a 2xx outside 200, 201, 202 and 204. 203 says a proxy transformed the reply; 205, 206 and 208 are not what a request to an API endpoint expects. The server answered, so it is never retried; it is reported as a failure the application can inspect.


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