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

Should we handle Cross-origin Request handling automatically? #3

Closed
arcfide opened this issue Feb 15, 2020 · 3 comments · Fixed by #8
Closed

Should we handle Cross-origin Request handling automatically? #3

arcfide opened this issue Feb 15, 2020 · 3 comments · Fixed by #8

Comments

@arcfide
Copy link
Contributor

arcfide commented Feb 15, 2020

The current Jarvis doesn't appear to handle CORS situations when browsers access the data. Is there a clean and minimal way to do this in Jarvis itself that doesn't get too "over-engineered?"

@arcfide
Copy link
Contributor Author

arcfide commented Feb 15, 2020

Looking into the code, it appears that Jarvis doesn't actually support any CORS handling for a JSON service, meaning that the service is inaccessible for a wide range of applications. I think it would be good to have CORS handling built-in.

@arcfide
Copy link
Contributor Author

arcfide commented Feb 16, 2020

The current code in HandleRequest might be able to be retrofitted to rely on the application provided Validate function to handle the request. The only issue is that there is no way to signal to the system that the Validate has in fact Validated and completed the response. It's only a pass/fail.

We could split into a pass / response / fail mode, or we could leave the Validate function as a pass/fail and then have another function that handles CORS.

At the moment I'm inclined to just use the pass / response / fail model. I suggest that the return code will indicate this. If it is 0, then it is a passthrough. If it's positive, it's a fail and should follow the normal fail path. If it's a -1, then it should immediately send the response that was crafted by the validate function.

@arcfide
Copy link
Contributor Author

arcfide commented Feb 17, 2020

c294037 adds support for CORS by default for JSON servers now.

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 a pull request may close this issue.

1 participant