Skip to content

Add MIME content type info to File#143

Merged
Kludex merged 16 commits intoKludex:masterfrom
jhnstrk:file_content_type
Apr 10, 2026
Merged

Add MIME content type info to File#143
Kludex merged 16 commits intoKludex:masterfrom
jhnstrk:file_content_type

Conversation

@jhnstrk
Copy link
Copy Markdown
Contributor

@jhnstrk jhnstrk commented Apr 30, 2024

Adds MIME type information as File.content_type as requested in issue #58.

Tests have been updated and a case-sensitive header issue was fixed too.

The part headers are also exposed as a dict, with keys as strings, lower-cased as File.headers.

Comment thread multipart/multipart.py Outdated
Comment thread multipart/multipart.py Outdated
Comment thread multipart/multipart.py Outdated
Comment thread multipart/multipart.py Outdated
Comment thread multipart/multipart.py Outdated
Makes all headers lower case, fixing case sensitivity issues.
Exposes jheaders property in Files and Fields.
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated

# Get the field and filename.
field_name = options.get(b"name")
field_name = options.get(b"name", b"")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is this needed? Isn't the field_name supposed to always be present?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this for typing. Without it, we'll need to raise or assert it's not None. Which makes sense actually.
Will probably need a test to cover it. too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the default value and added a check for None.

Comment thread python_multipart/multipart.py Outdated
jhnstrk and others added 4 commits December 16, 2024 19:13
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Copy link
Copy Markdown
Contributor Author

@jhnstrk jhnstrk left a comment

Choose a reason for hiding this comment

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

Updated the code in response to suggestions. Additional comments inline.

Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Comment thread python_multipart/multipart.py Outdated
Marcelo Trylesinski added 3 commits April 10, 2026 12:23
Comment thread python_multipart/multipart.py
Copy link
Copy Markdown
Owner

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

Sorry the delay. I've fixed some minor stuff. Thanks for contributing!

@Kludex Kludex merged commit d3a4698 into Kludex:master Apr 10, 2026
9 checks passed
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