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

Split serve_dir.rs into multiple files #250

Merged
merged 4 commits into from
Apr 25, 2022

Conversation

davidpdrsn
Copy link
Member

serve_dir.rs was getting quite big (1.4k lines) so thought it made sense to break up. This breaks the code into these modules:

  • future: Contains the response future and response generation code
  • headers: Contains some newtypes for a few headers. Was previously defined in the fs module but only used in serve_dir
  • open_file: Contains code for opening the file or possibly returning a response early
  • tests: Contains, well, the tests

Other than moving code around I made very few changes. The biggest one is renaming Output to OpenFileOutput and making the enum variants more specific. For example previously it contained a StatusCode variant which I replaced with explicit NotFound, PreconditionFailed, and NotModified variants.

@davidpdrsn davidpdrsn requested a review from Nehliin April 25, 2022 08:19
@davidpdrsn davidpdrsn mentioned this pull request Apr 25, 2022
10 tasks
Copy link
Collaborator

@Nehliin Nehliin left a comment

Choose a reason for hiding this comment

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

Nice

@davidpdrsn davidpdrsn merged commit 0c68c06 into master Apr 25, 2022
@davidpdrsn davidpdrsn deleted the serve-dir-method-not-allowed branch April 25, 2022 11:20
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