Interface: FpResponse
Defined in: fp-api.d.ts:190
The HTTP response.
Only available in post-response scripts. In pre-request scripts
fp.response is undefined. REQ-42 will tighten the type so the editor
reports an error when accessing it from a pre-request script.
Properties
Section titled “Properties”readonly body: string;Defined in: fp-api.d.ts:201
Raw response body as a string.
decodingStatus
Section titled “decodingStatus”readonly decodingStatus: "decoded" | "not-required" | "unsupported" | "failed";Defined in: fp-api.d.ts:215
Outcome of decoding the body against the response’s Content-Encoding:
'decoded', 'not-required' (no coding, identity, or no body),
'unsupported' (a coding the engine cannot decode — the body is as received),
or 'failed' (decoding errored — the body is as received).
headers
Section titled “headers”readonly headers: FpResponseHeaders;Defined in: fp-api.d.ts:198
Read-only case-insensitive response headers.
sizeBytes
Section titled “sizeBytes”readonly sizeBytes: number;Defined in: fp-api.d.ts:207
Size of the response body in bytes (after decoding a compressed response).
status
Section titled “status”readonly status: number;Defined in: fp-api.d.ts:192
HTTP status code (e.g. 200, 404, 500).
statusText
Section titled “statusText”readonly statusText: string;Defined in: fp-api.d.ts:195
Reason phrase sent by the server. May be empty for HTTP/2.
timingMs
Section titled “timingMs”readonly timingMs: number;Defined in: fp-api.d.ts:204
Total time from request-start to response-end, in milliseconds.
Methods
Section titled “Methods”json()
Section titled “json()”json(): any;Defined in: fp-api.d.ts:229
Parses the response body as JSON.
The result is typed as freely usable: reading any property, indexing, and
passing it into another fp.* method type-check without a diagnostic. The
response shape is unknown at author time, so no member set is asserted —
completion offers no suggestions on the result (REQ-0082).
Returns
Section titled “Returns”any
Throws
Section titled “Throws”if the body exceeds the 10 MB parse cap or is not valid JSON, or when
decodingStatus is 'failed' / 'unsupported' (the body could not be decoded).
xml2Json()
Section titled “xml2Json()”xml2Json(opts?): any;Defined in: fp-api.d.ts:247
Parses the response body as XML into a JSON-like object tree.
Uses fast-xml-parser under the hood with safe defaults (no entity
expansion, attribute names prefixed with @_). Repeated calls with no
options share a cached result within the same script execution.
The result is typed as freely usable, identically to FpResponse.json:
property access, nested access, and pass-through into another fp.* method
produce no diagnostic, and completion offers no member suggestions on it
(REQ-0082).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts? | FpXml2JsonOptions |
Returns
Section titled “Returns”any
Throws
Section titled “Throws”if the body exceeds the 10 MB parse cap or is not valid XML, or when
decodingStatus is 'failed' / 'unsupported' (the body could not be decoded).