Possible to use multiple origins with setGlobalDispatcher? #1440
Unanswered
paulrobertlloyd
asked this question in
Q&A
Replies: 1 comment 2 replies
-
the const mockAgent = new MockAgent()
const mockPool1 = mockAgent.get('https://server.example')
mockPool.intercept({ path: '/micropub' }).reply(200, 'foo')
const mockPool2 = mockAgent.get('https://token-endpoint.example')
mockPool.intercept({ path: '/token' }).reply(200, 'foobar')
const mockPool3 = mockAgent.get('https://website.example')
mockPool.intercept({ path: '/post/1000' }).reply(200, 'article') |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’d like to mock the following request:
This initial request can end up interacting with 3 different origins:
https://server.example
with a bearer tokenhttps://token-endpoint.example/token
https://website.example/post/1000
When setting up a
MockAgent
(orMockPool
) for this request, it appears as though I can only set one origin:I guess I could use a RegEx for the origin name, but is that the only conceivable approach? This would mean avoiding using
path
values that conflict with each other, and makes it less clear which origin is being mocked.I thought I might be able to use
setGlobalDispatcher()
multiple times, but looks like it’s only the agent set last that gets used.Beta Was this translation helpful? Give feedback.
All reactions