sercrod

*response

Summary

*response selects how an HTTP response, loaded value, adapter action result, or WebSocket message is written back into Sercrod host data.

Alias:

*response does nothing by itself. It is read by directives that explicitly produce a response/result and support response placement.

Used By

*download does not write response data.

Whole Response

Quoted strings select a data path for the whole response:

<button *post="'/api/save'" *keys="form" *response="'result'">
  Save
</button>

This writes:

data.result = response;

Unquoted values are evaluated in the current data scope:

<button *post="'/api/save'" *response="target_key">Save</button>

If target_key is "form.note", the whole response is written to data.form.note. Missing intermediate objects are created; dotted names are not literal property names.

Response Map

Object form maps selected response values into Sercrod data paths:

<button
  *post="'/api/profile'"
  *keys="profile"
  *response="{ user.name: response.profile.name, user.nicename: response.profile.nicename }">
  Save
</button>

Left side:

Right side:

Examples:

*response="{ user: response }"
*response="{ user: response.user }"
*response='{ user.name: "tom" }'

Default Behavior

Every successful request or supported adapter action mirrors the parsed response/result to $response unless that directive documents a narrower transient slot.

If *response is omitted, normal host data is not changed for communication directives that only mirror to $response. *fetch keeps its historical root replacement behavior when no *response is present.