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

FIX StaticFileServer: no longer serve ended requests for SPA's #1510

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dannys42
Copy link
Contributor

If a defaultIndex is specified and a previous middleware ended the
request, do not attempt to serve the static file

Description

When servicing a defaultIndex, first check whether a response has already been sent or that the response has ended.

Motivation and Context

If using StaticFileServer to serve an SPA (via defaultIndex) while also using routers to service API endpoints (e.g. that the static server may be communicating with), this will prevent the static server from appending the defaultIndex to the response.

How Has This Been Tested?

I have added a unit test to demonstrate and test for this situation.

Checklist:

  • [-] If applicable, I have updated the documentation accordingly.
  • If applicable, I have added tests to cover my changes.

- If a defaultIndex is specified and a previous middleware ended the
  request, do not attempt to serve the static file
@CLAassistant
Copy link

CLAassistant commented Aug 22, 2020

CLA assistant check
All committers have signed the CLA.

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.

None yet

2 participants