skonves / express-http-context

Get and set request-scoped context anywhere
MIT License
299 stars 26 forks source link

fix: check if there is an existing namespace before creating one #60

Open daxadal opened 6 months ago

daxadal commented 6 months ago

Solves https://github.com/skonves/express-http-context/issues/26

Changes

fix: check if there is an existing namespace before creating one

Description

As stated in https://github.com/skonves/express-http-context/issues/26#issuecomment-859488026, if the library is required in two different dependences, the code creates a new namespaces without checking if there is already an existing one. If the endpoint request travels through both of this dependencies, the context will be lost in the middle