Comments (7)
This needs to be verified in an actual usage scenario.
from interceptors.
Does this affect only the headers? I am planning to use the library to intercept and log outgoing http requests. I have a single middleware function that logs the method and url.href and does not return a mocked response. Does this sound like a scenario that will encounter the issue, with a high enough volume of requests and possible matching urls?
Thank you for your advice.
from interceptors.
Hi, @sean-hernon. I believe the issue is related to subsequent requests to the same endpoint, not necessarily to headers. I haven't got a capacity to reproduce this, would you mind giving me a hand? If we can get a reliable reproduction repository where this issue occurs, we can track it down and find a solution.
from interceptors.
Hi @kettanaito yes I would certainly like to help when I get some free time.
In the case where no mocked response is returned, do you foresee that the issue will cause the real request to be corrupted? If two requests made to the same endpoint, but with different methods are issued, do you foresee any conflict there?
from interceptors.
I have tried to reproduce this issue, but have had no luck so far. Do you have any more information related to how you encountered the issue?
Edit: To be more specific, I have been able to reproduced the issue like this, using the usual helpers inside the tests -
test('two concurrent requests are processed independently', async () => {
const requests = await Promise.all([
prepare(
httpRequest('http://httpbin.org/get'),
pool
),
prepare(
httpRequest('http://httpbin.org/get', {
headers: {
foo: 'bar',
},
}),
pool
)
])
expect(requests[1]?.headers).toHaveProperty('foo', 'bar')
})
But this is because prepare
uses findRequest
, which does not consider headers when looking-up the request in the pool. I wanted to check that the issue was not encountered in this manner.
from interceptors.
Thank you for assistance on this, @sean-hernon! Those insights are most useful.
Please, if you happen to reproduce it, could you submit a pull request with a failing test that does so? It doesn't have to contain a solution straight away, as a reliable reproduction would help us find one much faster. Thanks.
from interceptors.
@kettanaito Do you remember what you did exactly to see the issue? Was it exactly as in the steps to reproduce
?
from interceptors.
Related Issues (20)
- Intercepted fetch results in the the process never exiting / hangs Mocha tests
- error listener get called twice on mocked error with sync handler HOT 2
- Use "urlToHttpOptions" from "node:url"
- Header keys for requests are being converted to lowercase
- ReferenceError: TextEncoder is not defined when running (jest) tests HOT 4
- Treat exceptions as 500 responses instead of a "Failed to fetch" error HOT 7
- XMLHttpRequestController creates bad URL when location exists but href not set HOT 4
- Support aborting intercepted requests HOT 6
- WebSocket: Outgoing client events have the wrong "currentTarget" HOT 2
- WebSocket: Decide how to handle actual server errors
- Flaky: `modules/http/response/readable-stream.test.ts`
- ClientRequestInterceptor incorrectly encodes basic authentication header HOT 15
- Abstract request emitting logic
- Await all "response" listeners to finish HOT 4
- Protocol "https:" not supported. Expected "http:" when using "proxy-agent" HOT 1
- Simplify the npm package files HOT 2
- XMLHttpRequest upload (upload.onprogress) event is not supported
- Issue with native fetch introduce after 0.25.1? HOT 2
- Pending Socket interceptor tasks HOT 2
- Unclear how to throw an actual error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interceptors.