Documentation
¶
Overview ¶
Package polling holds helpers shared by generated *AndPoll service methods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecoverActionBody ¶
func RecoverActionBody[T any](raw *http.Response, recovered *T, opts ...option.RequestOption) ([]byte, error)
RecoverActionBody recovers the action response payload after the synchronous create/update returned, so the *AndPoll polling loop can enrich it.
It tries, in order:
- reading raw.Body (works when the caller passed WithResponseBodyInto with a **http.Response target — the request executor leaves the body intact).
- the bytes already populated into the caller's *[]byte target by the request executor (the body itself has been drained, but the bytes survive in the user's destination).
On success, raw.Body is reset to a fresh reader over the recovered bytes so downstream code can re-read it.
func WriteResponseBodyInto ¶ added in v0.47.0
func WriteResponseBodyInto(opts []option.RequestOption, enriched []byte)
WriteResponseBodyInto propagates the post-poll (status-enriched) body back to the *[]byte target the caller configured via option.WithResponseBodyInto, so they observe the polled state rather than the original action response. No-op when the caller did not request a *[]byte body.
Types ¶
This section is empty.