| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
authFetch is the authenticated drop-in for fetch but was an unbound class method, so passing it by reference (rdflib Fetcher, solid-logic, rdf-dereference, or destructuring) lost the this binding and threw on this._isActive. Bind it in the constructor; add a test that destructures and calls it.
There was a problem hiding this comment.
This PR hardens the Session public API so Session.authFetch behaves as a true drop-in fetch function even when passed by reference (e.g., via destructuring or when handed to libraries expecting a bare fetch).
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| solid-oidc.js | Binds authFetch in the constructor so it remains usable when passed by reference. |
| test.html | Adds a regression test covering destructured/by-reference usage of Session.authFetch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #11.
Session.authFetch is the authenticated drop-in for fetch, but it was an ordinary unbound class method, so passing it by reference lost this:
That breaks any consumer handing the authed fetch to a library expecting a bare fetch (rdflib Fetcher / UpdateManager, rdf-dereference, solid-logic) or destructuring it.
Change
One line in the Session constructor:
Plus a test in test.html that destructures authFetch and calls it with a mocked fetch, which throws pre-bind and passes post-bind.
Notes
Not a live regression for current consumers (they call session.authFetch(...) directly or go through a wrapper); this is hardening so the public API meets its drop-in-fetch contract.