FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add Custom Headers To File Server by frasermince · Pull Request #57 · purescript-hyper/hyper · GitHub

Add Custom Headers To File Server - #57

Open
frasermince wants to merge 3 commits into
purescript-hyper:masterfrom
frasermince:master
Open

Add Custom Headers To File Server#57
frasermince wants to merge 3 commits into
purescript-hyper:masterfrom
frasermince:master

Conversation

Copy link
Copy Markdown

I needed a way to have custom headers on the FileServer in order to Gzip the contents. I created another parameter to do that. Let me know if this is something that seems like would make sense for this or if there is a better way to do this than another parameter.

Copy link
Copy Markdown
Collaborator

Thanks for the PR! I have some things to consider:

  1. I think it's time to wrap up the arguments in a record, perhaps something like type FileServerOptions req res c = { on404 :: ..., additionalHeaders :: ... }. Then we can have a defaultFileServerOptions and cause less breakage when adding new things.
  2. Should the headers thing perhaps be a function instead? E.g. FilePath -> Stats -> Array (Tuple String String), that can inspect what file is being served and choose headers based on that.
  3. If we decide to go with a function, as discussed in point 2, it could also take the default headers as an argument, and have the possibility to filter them out. Not sure if that is useful, though.

What do you think?

owickstrom commented Dec 29, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator

Oh, by the way, have a look at the Travis CI report. There's an example that fails to compile. You can compile them with make examples.

Copy link
Copy Markdown
Author

Okay that sounds reasonable. And by FilePath -> Stats -> Array do you mean the stats type from Node.FS.Stats?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL