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

Fix malformed multipart body #1423

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

shemogumbe
Copy link

@shemogumbe shemogumbe commented Oct 16, 2024

Opened to replace #1069 which seems to be from a fork I can't access

Fixes #1068

@@ -93,7 +93,7 @@ interface MultipartEntry {
serializationCallback?: ModelSerializerFunction<Parsable>;
}

export const serializeMultipartBody = (writer: SerializationWriter, multipartBody: Partial<MultipartBody> | undefined | null = new MultipartBody()): void => {
Copy link
Member

Choose a reason for hiding this comment

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

please revert the const changes on this line. Here is more context https://www.freecodecamp.org/news/the-difference-between-arrow-functions-and-normal-functions/

@@ -30,51 +30,48 @@ export class MultipartSerializationWriter implements SerializationWriter {
public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined;
public onAfterObjectSerialization: ((value: Parsable) => void) | undefined;
public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined;
public writeStringValue = (key?: string, value?: string | null): void => {
public writeStringValue = (key?: string, value?: string): void => {
Copy link
Member

Choose a reason for hiding this comment

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

please revert the removal of null here as it does not conform with the interface

}
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public writeBooleanValue = (key?: string, value?: boolean | null): void => {
public writeBooleanValue = (key?: string, value?: boolean): void => {
Copy link
Member

Choose a reason for hiding this comment

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

same comment about the null option for all the following methods

if (first) {
first = false;
} else {
writer.writeStringValue(undefined, "");
writer.writeStringValue(undefined, "\r\n");
Copy link
Member

Choose a reason for hiding this comment

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

can we add a unit test to prevent future regressions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress 🚧
Development

Successfully merging this pull request may close these issues.

MultiPart Request Error
3 participants