[英]What causes the readable field to be set to false in express.js request?
New to expressjs and trying to debug the following issue I'm having locally: expressjs 新手并尝试调试我在本地遇到的以下问题:
console.log(req)
in the main error handler is that this readable
field is marked false
whereas in the /health endpoint it's marked true: console.log(req)
时,这个readable
字段被标记为false
而在 /health 端点中它被标记为 true: req: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
readable: false,
This just started happening in the past day or so so it's really baffling what change could have been made that would affect the POST /login endpoint's ability to fire when the server is run locally.这只是在过去一天左右才开始发生,所以当服务器在本地运行时,可能进行了哪些更改会影响 POST /login 端点的触发能力,这真是令人困惑。
An express request is a IncomingMessage
which is a readable stream and inherits its .readable
property :一个快速请求是一个
IncomingMessage
,它是一个可读的 stream并继承了它的.readable
属性:
Is
true
if it is safe to callreadable.read()
, which means the stream has not been destroyed or emitted 'error' or 'end'.如果调用
readable.read()
是安全的,则为true
,这意味着 ZF7B44CFFAFD5C52223D5498196C8A2E7BZ 尚未被销毁或发出“错误”或“结束”。
In short it means that the stream has not yet been completely consumed.简而言之,这意味着 stream 尚未完全消耗。 Since the body of a GET request is ignored (it has none), none of your middlewares will have read it, in contrast to the POST request.
由于 GET 请求的主体被忽略(它没有),与 POST 请求相比,您的中间件都不会读取它。 So this is expected, and doesn't help with your actual problem.
所以这是意料之中的,对您的实际问题没有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.