rsnext/test/integration/getserversideprops
Kara 41484f62cc
Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns

Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. during rendering), it
would currently happen to work because of when headers are sent. However,
this is an anti-pattern that relies an implementation detail of the framework
and shouldn't be allowed. This will be particularly important once Next.js
starts to support basic streaming (two-part flush: routing then data) because
then the headers will be sent as soon as gSSP returns, which explicitly breaks
this pattern.

With this commit, the framework now throws an error in development mode if
the ServerResponse is accessed after gSSP returns.

* fixup! Throw error if res is accessed after gSSP returns
2021-09-13 17:10:46 -05:00
..
pages Throw error if res is accessed after gSSP returns (#29010) 2021-09-13 17:10:46 -05:00
test Throw error if res is accessed after gSSP returns (#29010) 2021-09-13 17:10:46 -05:00
next.config.js Provide resolvedUrl to getServerSideProps (#17082) 2020-09-14 21:01:04 +00:00
world.txt Rename getServerProps to getServerSideProps (#10722) 2020-02-27 11:04:30 -06:00