-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add support for static HTTP response headers #458
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
Conversation
81fdaf7
to
6f30208
Compare
Add --headers argument support and update doco
6f30208
to
09f5f7b
Compare
Thanks for sending in a PR! Given that this will add the same header to ever request, what's the use case for this? |
My specific use case was for app development. I'm using http-server to test/develop API consumption against. I have vendor provided apps that provide some information in the headers that are necessary to consume the response data correctly. Rather than go through the process of setting up the data in the system (which I can't necessarily do), I just have saved responses that I serve up with http-server. I had been using Fiddler Autoresponder to inject the headers and http-server, but it made more sense to me to just add it as an option to the http-server. From a non-development standpoint, I didn't see any way to set the |
Completely agree that header customization is needed, but the scenarios where one would add the same header to all requests seem few. Take a look at #360 for something I'd like to get added at some point. It would allow per-file (at least) header customization via a |
The .headers idea is significantly better in a lot of ways and if done correctly, would be easy enough to use for static headers (like I need). Unless you think there's value to this PR in addition to that functionality, I'm going to close this PR and take a crack at the headers idea. |
FWIW, it looks like the underlying Consequently, it probably makes sense to expose that option via I'd still love Balancing flexibility and focus is tricky. Input welcome! |
+1 from me. |
@numical would you like to take a crack at a PR for #360? For this PR specifically, I'd like to rename the @jimlawhorn would you be up for tackling the above tweak? |
Cannot commit at the moment - sorry. |
@BigBlueHat - I have got as far as forking the repo and taking a look. Looks interesting if I can find the time! In the meantime could you accept this @jimlawhorn's current PR? It would satisfy my current needs. |
I'm looking at updating the original PR. |
Submitted updates for the static header options. I opened #460 a while ago for the dynamic headers. Not seen any feedback on it, but I'd love any comments. |
@jimlawhorn this is looking good! Could you add some tests to handle the new feature? Also, it might be good to make "H" the alias, so the code reads more clearly (i.e. Thanks! |
Closing in favor of the simpler and older #282 |
Add --headers argument support and update doco