Skip to content

feat: use form-data for dataValues endpoints#1133

Merged
KaiVandivier merged 1 commit intomasterfrom
feat-formdata-for-data-values
Feb 26, 2022
Merged

feat: use form-data for dataValues endpoints#1133
KaiVandivier merged 1 commit intomasterfrom
feat-formdata-for-data-values

Conversation

@KaiVandivier
Copy link
Copy Markdown
Contributor

This facilitates some work in the Data Entry app: the /api/dataValues endpoint accepts either form-data or query params, but not JSON -- being able to send the data using the data property of the query feels more semantic than sending it in the query params. The api/dataValues/file endpoint needs to use form-data to send files.

@KaiVandivier KaiVandivier force-pushed the feat-formdata-for-data-values branch from 323017b to 24b4ce4 Compare February 26, 2022 13:13
Copy link
Copy Markdown
Contributor

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Am I missing something or is this function not called anywhere?

@KaiVandivier
Copy link
Copy Markdown
Contributor Author

KaiVandivier commented Feb 26, 2022

It’s batched in with other matchers here:

const resourceExpectsMultipartFormData = (
type: FetchType,
query: ResolvedResourceQuery
) =>
Object.values(multipartFormDataMatchers).some(multipartFormDataMatcher =>
multipartFormDataMatcher(type, query)
)

@KaiVandivier KaiVandivier requested a review from amcgee February 26, 2022 15:03
Copy link
Copy Markdown
Contributor

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Got it, thanks. I think we should generally avoid the import * pattern, for this reason, but that's a separate issue

@KaiVandivier KaiVandivier merged commit a67b926 into master Feb 26, 2022
@KaiVandivier KaiVandivier deleted the feat-formdata-for-data-values branch February 26, 2022 15:24
dhis2-bot added a commit that referenced this pull request Feb 26, 2022
# [3.3.0](v3.2.9...v3.3.0) (2022-02-26)

### Features

* use form-data for dataValues endpoints ([#1133](#1133)) ([a67b926](a67b926))
@dhis2-bot
Copy link
Copy Markdown
Contributor

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants