Comments (10)
It could definitely be got
not emitting end
. I will look into that. Thanks @mikicho
from nock.
Hey @busma13, have you gotten any further with this? We're having a similar issue on taskcluster while trying to upgrade to the latest version of node.
from nock.
@busma13 any chance the regression is in got
side? from what I see, handleEnd
is never get called.
from nock.
@matt-boris No I haven't, we were okay with disabling the test because the function was covered well in e2e testing, so it lost priority. I wanted to search through the got
issues to see if someone else had a similar problem before making my own, but I never finished that. Are you using got
to make requests as well?
from nock.
@busma13 yes, we're using got
as well.
from nock.
I think this is a got issue and not a nock issue as I did a quick switch to use axios instead of got and it worked
UPDATE: this was using got v13.0.0
from nock.
const nock = require('nock')
const fs = require('fs')
const axios = require('axios')
const myFile = 'somefile.txt'
const host = 'http://example.com'
const path = '/some/path'
const response = { foo: 'bar' }
const options = {
method: 'post',
url: host + path,
body: fs.createReadStream(myFile)
}
nock(host)
.post(path)
.reply(200, response)
const run = async () => {
const { default: got } = await import('got')
try {
const result = await got(options)
console.log(result.body)
} catch (error) {
console.error('error')
console.error(error)
}
console.log('complete')
}
run()
As a minimal recreate. The oddness is that if I switch the url to https://httpbin.org/post
it works, but if I switch got to axios it works too. Almost as if it's the combination of the two
from nock.
Thanks for verifying this!
Can we close this one?
from nock.
Thanks @stephen-willoughby
Yeah I'll close this.
from nock.
Any chance this could be reopened?
got aren't interested in addressing it. And it seems to specifically be around the use of both got and nock. On sindresorhus/got#2341 someone has suggested a workaround, with a patch of nock, but I've no idea of its validity
from nock.
Related Issues (20)
- Convenience method to match all HTTP verbs
- enableNetConnect does not work w nock.recorder.rec() HOT 1
- [Node 18.12] Class extends value undefined is not a constructor or null HOT 2
- incompatible behaviour introduced with v13.3.2 HOT 17
- Interceptors not being removed in 13.3.2 HOT 2
- Replace npm debug with require('node:util').debuglog HOT 2
- Remove lodash HOT 1
- Application to become a nock maintainer. HOT 5
- Expand function fails on weird GET query params HOT 4
- reqheaders does not work when using an undefined requestBody HOT 3
- Add interceptor at the beginning of list
- Return 500 instead of 404 HOT 4
- Bun support for nock.disableNetConnect() HOT 1
- DNS resolve errors and not mocking a lot of requests HOT 7
- Disabled discussions HOT 6
- Improve debug logging HOT 2
- Support Abort Signals HOT 1
- Add JSDoc HOT 8
- Using nock inside a stream pipeline with got causes it to hang forever since Node 20.10.0 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 nock.