Skip to content

submissions: add test for chunked requests with attachments #1466

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Mar 28, 2025

Ref getodk/central#940

What has been done to verify that this works as intended?

Ran the test without pipe() call, and observed that transfer is not chunked, and the test failed.

Why is this the best possible solution? Were any other approaches considered?

It could be done more explicitly with lower-level libs, e.g. node:http. That would make the code more different from existing tests for similar endpoints.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No effect.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

No.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@alxndrsn alxndrsn requested a review from lognaturel March 28, 2025 08:49
attachments.append('here_is_file2.jpg', Buffer.from('this is test file two'), 'here_is_file2.jpg');

const req = asAlice.post('/v1/projects/1/submission')
.set('X-OpenRosa-Version', '1.0')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing the OpenRosa API only, right? The issue appears to be with the Central API endpoint (https://docs.getodk.org/central-api-submission-management/#uploading-an-attachment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added another example test (which passes) at #1468.

Hopefully that one is for the correct API.

It would be really helpful to get a reproduction of getodk/central#940.

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.

2 participants