Commit Graph

103 Commits

Author SHA1 Message Date
maxbronnikov10
07603b53f2 refactor(core,express,fastify): HTTP adapter error mapping 2026-02-16 00:53:54 +03:00
Himanshu Gupta
decb89bf02 refactor(common,express): rename graceful shutdown option
Rename gracefulShutdown to return503OnClosing to align the HTTP
option name with Fastify's terminology. The previous name was too
vague and could imply broader behavior (connection draining, grace
periods) beyond what it actually does.
2026-02-15 23:27:34 +05:30
Himanshu Gupta
26953bab74 fix(common,core,express): activate shutdown flag before hooks
Move isShuttingDown flag activation from dispose() to a new
prepareClose() step that runs before callDestroyHook(). This prevents
new requests from being processed while providers are being destroyed
during shutdown.

Add beforeClose() to HttpServer interface and AbstractHttpAdapter so
adapters can be notified before the shutdown lifecycle begins.
2026-02-15 23:27:34 +05:30
Himanshu Gupta
ea352f63eb chore(express): Remove debug logs from express adapter
Remove leftover debug logging statements to reduce console noise in the adapter.
2026-02-15 23:27:34 +05:30
Himanshu Gupta
319437ac3f feat(common,express): add graceful shutdown option
Closes #11416
2026-02-15 23:27:34 +05:30
Kamil Myśliwiec
09c81568f8 feat: introduce standard schema serializer 2026-02-15 13:07:08 +01:00
Kamil Myśliwiec
473810cc85 chore: introduce the internal export path 2026-02-13 17:40:00 +01:00
Kamil Myśliwiec
33f37d6270 refactor: minor tweaks 2026-02-09 16:05:02 +01:00
Kamil Myśliwiec
fa6d45da74 build: migrate from cjs to esm 2026-02-09 14:10:04 +01:00
Kamil Myśliwiec
436e1de258 style: address linter warnings 2025-07-14 13:37:13 +02:00
Kamil Myśliwiec
adc7e1547f feat: enhance introspection capabilities 2025-07-14 11:37:49 +02:00
Jay McDoniel
3de1ec255a feat: remove use of pipeline
Pipeline is great for when multiple streams need to be used together
but can also end up causing problems when there's a readstream of a
large file being sent in chunks, because the streams get destroyed
early. Technically, everything works fine, but there's warnings in
the terminal that could be misleading, so calling the streams with
error handlers directly is a safer way to go about it.
2025-04-23 08:46:33 -07:00
luddwichr
eff8f156d1 fix(platform-express) respect existing parser middlewares when using Express 5
Express 5 made the router public API again and renamed the field from app._router to app.router.
This broke the detection mechanism whether a middleware named "jsonParser" or "urlencodedParser"
is already registered or not.
Unfortunately, https://github.com/nestjs/nest/pull/14574/ only fixed the issue partially.
This commit now uses app.router everywhere.
To avoid future regressions a test was added to verify the expected behavior.
2025-02-14 22:25:16 +01:00
luddwichr
9ae019f3ec fix(platform-express) make check for already registered parsers work with Express 5
Express 5 made the router public API again and renamed the field from app._router to app.router.
This broke the detection mechanism whether a middleware named "jsonParser" or "urlencodedParser"
is already re or not, because app._router no longer exists.
2025-02-05 22:23:59 +01:00
Phillip9587
9aa2a43377 fix: use express body-parser reexports 2025-01-17 14:18:16 +01:00
Kamil Myśliwiec
d6b9feefcb fix: normalize middle wildcards, call path-to-regexp early 2025-01-16 12:52:41 +01:00
Kamil Myśliwiec
7197cc1a8a feat: add normalize path to http adapter 2024-11-28 14:06:15 +01:00
Kamil Myśliwiec
7f142e9399 feat: add legacy route converter, update tests 2024-11-28 11:28:56 +01:00
Kamil Myśliwiec
7d3e5c1a38 build: use strict null checks part 5 2024-11-26 14:39:51 +01:00
Kamil Myśliwiec
10fdf16c47 build: use strict null checks part 1 2024-11-26 12:46:59 +01:00
=
cfd0ab69a0 feat: Implement getHeader and appendHeader methods in adapters
The setHeader method would replace a header, while there can be multiple headers with the same name
2023-12-20 18:39:59 -03:00
Jay McDoniel
80061af00e feat: allow for custom logger with streamable files 2023-10-11 10:36:59 -07:00
Micael Levi L. Cavalcante
ec43dc8429 fix(express): when content-type header is null 2023-09-21 17:52:08 -04:00
Kamil Kiwior
4f391c2bfd fix(platform-express): improve reply content-type check 2023-06-30 13:43:02 +02:00
Kamil Myśliwiec
702eebf9b5 chore: resolve conflicts 2023-04-05 13:10:23 +02:00
Tolga Paksoy
1af7d379db fix(express): remove body-parser types and use own 2023-03-23 12:01:16 +01:00
Micael Levi L. Cavalcante
545d69c0f6 fix(platform-express): replace net.server with http.server 2023-03-14 14:44:13 -04:00
codytseng
cf4097cf24 feat(common,express,fastify): enhance the type of httpServer 2023-02-15 14:42:03 +08:00
Tony133
15e4a5f9f1 chore(platform): mark facing apis public adapter express, socket.io, ws 2023-02-03 12:18:36 +01:00
Kamil Mysliwiec
da708c7216 Merge pull request #10474 from tuxmachine/fix/8469-fastify-errors-content-type
Fix Content-Type for unexpected errors in Fastify
2023-02-02 13:34:49 +01:00
Tolga Paksoy
a25bfa86ed refactor(platform): extract platform implementation detail to interfaces 2022-12-05 18:03:10 +01:00
Tolga Paksoy
0444f9c89e feat(platform): enable body parser with raw body support 2022-12-05 17:52:08 +01:00
Kamil Mysliwiec
fc6b34be87 Merge pull request #10345 from tolgap/fix/9517-keep-alive-connections-blocking
fix(platform): shutdown hooks not firing caused by open http connections
2022-11-07 11:02:20 +01:00
Kamil Mysliwiec
1f376fea52 Update packages/platform-express/adapters/express-adapter.ts 2022-11-07 10:44:54 +01:00
Rick Dutour Geerling
ddf3301d49 fix(express): always return errors as application/json
If user overrides the Content-Type but doesn't add a custom exception
filter to handle errors, then Nest will respond with a JSON error
object. We should ensure the Content-Type header matches the body
in this case.
2022-10-31 12:09:24 +01:00
Micael Levi L. Cavalcante
d6a89fa613 feat(plataform-express): replace any return type on #listen 2022-10-30 15:20:13 -04:00
Tolga Paksoy
dd3a773985 feat(common): add option to enable force closing http connections 2022-10-24 16:49:45 +02:00
Tolga Paksoy
07bef1ba59 fix(express): shutdown hooks not firing cased by open http connections 2022-10-20 16:56:11 +02:00
Tony133
ca72d2eb7a chore(): remove unused declarations 2022-07-25 23:15:44 +02:00
Kamil Mysliwiec
429dfa1382 Merge pull request #9819 from jmcdo29/fix/pipeline-over-pipe
fix: use pipeline over stream.pipe
2022-07-20 10:39:36 +02:00
Jay McDoniel
9739aa6a1a fix: move logger to class member 2022-07-18 07:56:45 -07:00
Jay McDoniel
f59cf5e81c feat: update handler to be protected and only handle errors once 2022-07-17 14:56:45 -07:00
Tolga Paksoy
50716eb0cd fix(express,fastify): raw body for urlencoded requests 2022-07-13 18:47:03 +02:00
Jay McDoniel
18c27cd790 fix: use pipeline over stream.pipe
`pipeline` ends up destroying streams used if there is an error in one of
the streams. Due to this, there's no chance of a memory leak from errored out
streams. There's also now an addition of adding an error handler to the
`StreamableFile` so that stream errors by default return a 400 and can be
customized to return an error message however a developer would like. These
only effect the express adapter because of how Fastify already internally
handles streams.

fix: #9759
2022-06-23 08:49:57 -07:00
Kamil Mysliwiec
e091cd5c07 Merge pull request #8802 from wSedlacek/fix/interceptor-check-headers-sent
fix: only send exception responses if header is not already sent
2022-06-20 15:00:38 +02:00
Kamil Myśliwiec
2b10ff60c6 chore(): resolve conflicts 2022-05-31 11:47:17 +02:00
Micael Levi (@micalevisk)
dca949ae32 refactor(express): improve applyVersioning handler selector code 2022-05-23 06:23:02 -04:00
Micael Levi (@micalevisk)
0e337d0e3a feat(common,core): make HttpServer#applyVersionFilter mandatory 2022-05-17 20:16:12 -04:00
Kamil Myśliwiec
71e3143d90 style(): minor foramtting tweaks 2022-05-17 13:45:29 +02:00
Kamil Myśliwiec
2eaee87f09 Merge branch 'express-raw-body' of https://github.com/tolgap/nest into tolgap-express-raw-body 2022-05-17 13:44:04 +02:00