Skip to content
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

refactor: use a default contentType of application/json in Forms #1176

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

Conversation

JKRhb
Copy link
Member

@JKRhb JKRhb commented Nov 29, 2023

As discussed in #1175 (comment), this PR includes a proposal for making the contentType of the Form class non-nullable by defaulting to application/json when no Content-Type is passed to the constructor.

This change has the nice effect of getting rid of a lot of nullish coalescing which is currently required to arrive at the default value which had the potential for causing some inconsistencies across the codebase.

@JKRhb
Copy link
Member Author

JKRhb commented Nov 29, 2023

Hmm, it seems as if for this to work, the contentType field on the FormElementBase interface in the wot-typescript-definitions would need to be changed as well.

@danielpeintner
Copy link
Member

Hmm, it seems as if for this to work, the contentType field on the FormElementBase interface in the wot-typescript-definitions would need to be changed as well.

Note: the mentioned field is auto-generated based on the JSON Schema...

@JKRhb JKRhb force-pushed the form-default-content-type branch from a5c9e85 to 7ab34e4 Compare July 9, 2024 20:22
@JKRhb JKRhb force-pushed the form-default-content-type branch from 7ab34e4 to 01cc16e Compare July 9, 2024 20:24
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