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

Implement getters for named file fields #2021

Closed
wants to merge 3 commits into from

Conversation

SuperFluffy
Copy link
Contributor

@SuperFluffy SuperFluffy commented Feb 22, 2021

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

I wanted to change ContentDisposition to always be attachment no matter the underlying file type. But since there is currently no way to retrieve the current content disposition of NamedFile, I would have to guess the filename parameter for this header.

And since the other fields might also potentially be interesting to users, getter methods for those were added as well.

Open questions

I did not add pub fn flags(&self) -> &Flags, because having the bit mask is quite meaningless without knowing what the bits stand for. Since there is no set_flags setter either, should we add methods like pub fn is_FLAG_set(&self) -> bool? For example, pub fn is_etag_set(&self) -> bool?

@robjtede robjtede added A-files project: actix-files B-semver-minor labels Feb 24, 2021
@SuperFluffy
Copy link
Contributor Author

Are you fine with the tests being doc tests that just check for compilation, similar to the path and file getters?

Also, should I add some methods to check if flags are set?

Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

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

otherwise, looks okay. for is_*_set, we can omit it for now unless someone brings a use case

yes, doc tests would be enough


/// Retrieve the metadata associated with this file.
#[inline]
pub fn md(&self) -> &Metadata {
Copy link
Member

Choose a reason for hiding this comment

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

would call this metadata

@robjtede robjtede added this to the actix-web post-v4 milestone Nov 18, 2021
@robjtede robjtede removed this from the actix-web post-v4 milestone Mar 1, 2022
@robjtede
Copy link
Member

robjtede commented Mar 10, 2022

superseded by #2689 due to restricted branch

thanks for getting this added 👍🏻

@robjtede robjtede closed this Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-files project: actix-files B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants