You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_record() JSON-parses application/jsonl and other application/json* types and raises InvalidResponseBodyError #1140
KeyValueStoreClient.get_record() JSON-parses the body whenever the content type matches ^application/json (key_value_store.py#L48-L64). That prefix also matches types whose body is not a single JSON document, such as application/jsonl and application/json-seq. A record saved with set_record('items', '{"a":1}\n{"a":2}', content_type='application/jsonl') cannot be read back with get_record(): response.json() fails and the client raises InvalidResponseBodyError. Types like application/json-patch+json happen to parse, because their body is valid JSON.
The JS client uses the same prefix to decide whether to decode the body as text, but JSON-parses only the exact type application/json (body_parser.ts#L4-L5, #L40). It returns application/jsonl and application/json-patch+json records as strings. Structured-syntax types such as application/ld+json or application/vnd.api+json match neither prefix and come back as raw bytes in both clients.
Expected behavior
get_record() returns application/jsonl, application/json-seq and other application/json* types whose body is not a single JSON document as text, so reading them back no longer fails. Parsing only the exact application/json type, as the JS client does, would also turn application/json-patch+json records from a dict into a string. That part changes return types and is best settled together with apify-client-js#1067.
Activity