Skip to content

serializeRequest performs JSON.stringify on a Buffer #277

Closed

Description

@szmarczak

function serializeRequest(config: ApifyRequestConfig): ApifyRequestConfig {

if (type === 'application/json' && typeof config.data === 'object') {
config.data = stringifyWithFunctions(config.data);

function stringifyWithFunctions(obj: JsonObject) {
return JSON.stringify(obj, (_key, value) => {
return typeof value === 'function' ? value.toString() : value;
});
}

I was wondering why I was receiving {"type":"Buffer","data":[...]} instead of actual data...
This breaks .call(buffer, { contentType: 'application/json' }).

Activity

  1. szmarczak commented on Sep 26, 2022

    @szmarczak
    Author
  2. added
    t-toolingIssues with this label are in the ownership of the tooling team.
    on Mar 8, 2023
  3. added this to the 3.0 milestone on Sep 16, 2026
  4. vdusek commented on Sep 16, 2026

    @vdusek
    Contributor

    This could be worth checking out before v3 ships, as the fix might be breaking. Moving this to the 3.0 milestone.

  5. self-assigned this
    on Sep 16, 2026
  6. vdusek commented on Sep 25, 2026

    @vdusek
    Contributor

    This was resolved in #1051 and #1058, with a regression test added in #1078.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions