Skip to content

docs: document content-type parsing in getRecord() and setRecord() - #1082

Merged
vdusek merged 1 commit into
v3from
docs/get-record-content-type-parsing
Sep 25, 2026
Merged

vdusek merged 1 commit into
v3from
docs/get-record-content-type-parsing

Conversation

@vdusek

@vdusek vdusek commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

getRecord() keeps parsing records by content type. The Python client does the same, and Crawlee's KeyValueStore.getValue() expects parsed JSON back, so a different default would break both for a rare case. The alternative of returning the raw body when parsing fails is also out: a JSON body truncated by a dropped connection would then come back as a string without any error.

This PR documents the behavior instead. The getRecord() JSDoc now lists the parsing rules and says that a body that doesn't parse throws InvalidResponseBodyError, with the raw body in error.response. It also says that buffer: true skips parsing. The setRecord() JSDoc says a string is sent as it is even under application/json, so it has to be valid JSON already.

Relates #1067

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Sep 25, 2026
@vdusek vdusek self-assigned this Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ There are broken links in the documentation.

See more at https://github.com/apify/apify-client-js/actions/runs/36114715259#summary-108005969222

@vdusek
vdusek marked this pull request as ready for review September 25, 2026 08:53
@vdusek
vdusek merged commit ae6d158 into v3 Sep 25, 2026
8 checks passed
@vdusek
vdusek deleted the docs/get-record-content-type-parsing branch September 25, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants