Skip to content

fix/ensure array params are sent to the server correctly #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025

Conversation

awalker4
Copy link
Collaborator

@awalker4 awalker4 commented May 22, 2025

Fixes #135

The SDK sends the wrong formdata when the user adds an array param. For instance, the following call:

client.general.partition({
    partitionParameters: {
        files: {
            content: data,
            fileName: filename
        },
        extractImageBlockTypes: ["Image", "Table"],
    }
})

Sends the list as one comma separated FormData value: `extract_image_block_types: "Image,Table"'.

The server will ignore this unless it's sent with multiple keys like so: extract_image_block_types[]: "Image", extract_image_block_types[]: "Table"

We addressed this before in #122 by adjusting the request body before sending it, but this code path is for pdf splitting. A better solution is to add a new hook that will clean up the form data for every request. Then we can remove the modification in the splitting code.

@awalker4 awalker4 requested a review from jordan-homan May 22, 2025 16:31
@awalker4 awalker4 force-pushed the fix/array-param-bug branch from ceb624d to 964b249 Compare May 22, 2025 16:34
@awalker4 awalker4 force-pushed the fix/array-param-bug branch from 98cce10 to ec9e044 Compare May 22, 2025 16:41
@awalker4 awalker4 merged commit bfe73b1 into main May 29, 2025
2 checks passed
@awalker4 awalker4 deleted the fix/array-param-bug branch May 29, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to access base64 images
2 participants