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

[Typescript-Angular] canConsumeForm function can be simplified #12439

Open
seofernando25 opened this issue Aug 7, 2024 · 0 comments
Open

[Typescript-Angular] canConsumeForm function can be simplified #12439

seofernando25 opened this issue Aug 7, 2024 · 0 comments

Comments

@seofernando25
Copy link

seofernando25 commented Aug 7, 2024

Description

typescript-angular's canConsumeForm can be simplified

Swagger-codegen version

3.X

Suggest a fix/enhancement

private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}

canConsumeForm is equivalent to just return consumes.includes('multipart/form-data');

/**
 * @param consumes string[] mime-types
 * @return true: consumes contains 'multipart/form-data', false: otherwise
 */
private canConsumeForm(consumes: string[]): boolean {
  return consumes.includes('multipart/form-data');
}
@seofernando25 seofernando25 changed the title canConsumeForm function can be simplified typescript-angular's canConsumeForm function can be simplified Aug 7, 2024
@seofernando25 seofernando25 changed the title typescript-angular's canConsumeForm function can be simplified [Typescript-Angular] canConsumeForm function can be simplified Aug 7, 2024
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

No branches or pull requests

1 participant