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

added two parameters: only-get-or-head and check-index #16

Merged
merged 13 commits into from
Sep 21, 2022
Merged

added two parameters: only-get-or-head and check-index #16

merged 13 commits into from
Sep 21, 2022

Conversation

tts-sdrissen
Copy link
Contributor

Description

I am using your project to mock an API for testing purposes.
I needed two more functions to make it work.

Problem

I need to test API requests to something like /users/1 AND /users/1/profile .
So what I did was creating a folder structure and placed in the "/users/1"-folder an index.html
But it returns a directory listing even if a index.html is present.

And I need POST requests, but the original code blocks them.

Solution

Introduced parameter check-index for looking for index.html, before return directory listing.
Introduced parameter only-get-or-head to allow to set it to false, to ignore method check.

Notes

If you merge this, nothing significant will happen for existing users, because the default parameters say not to use the functions introduced in this request.

@Eun
Copy link
Owner

Eun commented Sep 9, 2022

Thank you for your contribution! 👍
I see the usecase.
I also would like to see the feature implemented, however I think there are some problems with long time use of the features you added.

  1. When introducing an index handler it is required that the index file can be specified. (Some users use index.html, others use index.htm)
    The best solution would be to add an array parameter where devs could specify what should be handled:
    index-files: [index.html, index.htm]
    1.1. Making the directory listing configurable would be the next logical step when adding an index handler.
  2. The "only get or head" feature should follow the same pattern:
    allowed-methods: [GET, HEAD]

Let me know if you intend to make the changes. 😃

@tts-sdrissen
Copy link
Contributor Author

Nice to see, that you reviewed my pull request!
I think that your comments are reasonable and I started to make the changes you suggested.

I committed "requested changes" and I can see it in this pull request - not sure, if you can see it, too.
But it is not tested yet... I will approve it, as soon as my Github Action for another projects ran without an issue.

@tts-sdrissen
Copy link
Contributor Author

Okay, the requested modifications are working.
And you should see the commit "requested changes" and "minor fixes".

Be aware, that I modified the README in "my" repo for copyright reasons.
Better check every file before merge 😅

Copy link
Owner

@Eun Eun left a comment

Choose a reason for hiding this comment

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

Thanks, for the work! 💪
I checked the code, just one tiny bug, a bit of cleaning up. Then I would love to merge 😃
I suggested all the changes so you just need to accept them 👍

main.js Outdated Show resolved Hide resolved
main.js Outdated Show resolved Hide resolved
server.js Outdated Show resolved Hide resolved
server.js Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
tts-sdrissen and others added 6 commits September 21, 2022 00:31
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
as @Eun suggested

Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
@tts-sdrissen
Copy link
Contributor Author

I approved the changes and found an error in the README.md - Tabs instead of spaces.
After you merge those changes, can I delete my fork?

@Eun Eun changed the base branch from master to draft September 21, 2022 07:10
@Eun Eun merged commit cde613e into Eun:draft Sep 21, 2022
@Eun
Copy link
Owner

Eun commented Sep 21, 2022

Yes you can delete your fork, thanks again 👍

Eun added a commit that referenced this pull request Sep 21, 2022
Co-authored-by: Tobias Salzmann <796084+Eun@users.noreply.github.com>
Co-authored-by: tts-sdrissen <65233457+tts-sdrissen@users.noreply.github.com>
@tts-sdrissen
Copy link
Contributor Author

It even says "If you wish, you can delete this fork of Eun/http-server-action in the settings."

It was a pleasure to collaborate with you.

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