-
Notifications
You must be signed in to change notification settings - Fork 352
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
feat: Fetch adapter support for context
provided via adapterOptions
#66
Conversation
one.connectTo(FetchAdapter); | ||
|
||
expect(function() { | ||
two.connectTo(FetchAdapter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connectTo
vs providing the adapter via configure
so that the constructor assignment happens and we can do cleanup (i.e., stop()
)
89d9c8c
to
0da3667
Compare
this.assert('Fetch global not found.', nativeFetch); | ||
const { context } = this.options; | ||
|
||
this.assert('Fetch global not found.', context.fetch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!(context && context.fetch)
Assert only checks for false or undefined. Might wanna open that up to any falsey value.
this.handleRequest({ | ||
url, | ||
method: options.method || 'GET', | ||
headers: FetchUtils.serializeHeaders(options.headers), | ||
body: options.body, | ||
requestArguments: [url, options] | ||
}); | ||
|
||
defineProperty(context.fetch, STUB_META, { value: {} }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a meta object vs a Boolean?
@@ -21,3 +21,36 @@ describe('Integration | Fetch Adapter', function() { | |||
adapterTests(); | |||
adapterBrowserTests(); | |||
}); | |||
|
|||
describe('Integration | Fetch Adapter | Concurrency', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test against a null context and one without fetch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup need to add tests in general around context. Will finish up tonight + docs
I just meant the logic around checking the STUB_META instead of checking against the captured native class in the module. That way, we can still wrap a pre modified XHR. |
I'll tackle in a separate PR tomorrow since I want to chat first. |
83677b4
to
05dbcc0
Compare
05dbcc0
to
8f43b9a
Compare
I'll update the docs also.
I can't apply the same treatment to the XHR adapter since
nise
doesn't enable providing a context object. I think we spoke about this already, but mentioning again.Resolves #56