I've been trying to figure out `ServerRequestConte...
# micronaut
d
I've been trying to figure out
ServerRequestContext
... why is it that the wrapping functions call
REQUEST.remove()
rather than
REQUEST.set(existing)
? e.g. https://github.com/micronaut-projects/micronaut-core/blob/afc3fb377fea37f942c1a251be19b58f9f989b22/http/src/main/java/io/micronaut/http/context/ServerRequestContext.java#L55 Wouldn't it make more sense to restore the original, rather than clearing out the request altogether? Currently, calling the wrappers ends up permanently losing the original context (if one existed) if you ever call with another. I did find this commit indicating that the
if (request != existing)
logic was added later... so perhaps it is just an oversight? https://github.com/micronaut-projects/micronaut-core/commit/a9640ba536b94e96ae81e668f80ba39f3454fd32