Skip to content

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.

readonly body: string;

Defined in: fp-api.d.ts:201

Raw response body as a string.


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).


readonly headers: FpResponseHeaders;

Defined in: fp-api.d.ts:198

Read-only case-insensitive response headers.


readonly sizeBytes: number;

Defined in: fp-api.d.ts:207

Size of the response body in bytes (after decoding a compressed response).


readonly status: number;

Defined in: fp-api.d.ts:192

HTTP status code (e.g. 200, 404, 500).


readonly statusText: string;

Defined in: fp-api.d.ts:195

Reason phrase sent by the server. May be empty for HTTP/2.


readonly timingMs: number;

Defined in: fp-api.d.ts:204

Total time from request-start to response-end, in milliseconds.

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).

any

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(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).

ParameterType
opts?FpXml2JsonOptions

any

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).