docsify
docsify copied to clipboard
Fix #1422
Summary
What kind of change does this PR introduce? (check at least one)
- [X] Bugfix
- [ ] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Docs
- [ ] Build-related changes
- [ ] Repo settings
- [ ] Other, please describe:
If changing the UI of default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
- [ ] Yes
- [X] No
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
- [X] When resolving a specific issue, it's referenced in the PR's title (e.g.
fix #xxx[,#xxx]
, where "xxx" is the issue number)
You have tested in the following browsers: (Providing a detailed version will be better.)
- [X] Chrome
- [X] Firefox
- [ ] Safari
- [ ] Edge
- [ ] IE
If adding a new feature, the PR's description includes:
- [ ] A convincing reason for adding this feature
- [ ] Related documents have been updated
- [ ] Related tests have been updated
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/3my2ep9BKksh42wYXVso66vg9KLo
✅ Preview: https://docsify-preview-git-fork-cmbaatz-develop-docsify-core.vercel.app
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 8b7e8959a79f51957f40b2026d06c3ae4f2d85d3:
Sandbox | Source |
---|---|
docsify-template | Configuration |
I agree with @Koooooo-7. We can't default to settings withCredentials
to true
.
My initial thought is that modifying the xhr object is best handled via a new hook instead of a configuration option. This provides greater flexibility, including the ability to modify the xhr object based on the request URL:
window.$docsify = {
plugins: [
function(hook, vm) {
hook.beforeRequest(function(xhr, url) {
// Domain-specific XHR settings
if (/some-domain.com/.test(url)) {
xhr.withCredentials = true;
xhr.setRequestHeader("foo", "1");
xhr.setRequestHeader("bar", "2");
}
});
}
]
};
Thoughts @docsifyjs/core ?
I agree with @jhildenbiddle , Our config is getting huge lately. We need some kind of solution to limit that and customize futher.
I agree with the hook and custom plugin.
@cmbaatz please create an issue with the details and we can have a discussion there.