Repository navigation
Conversation
| func (s *Server) ServeHTTPWithOriginalURI(responseWriter http.ResponseWriter, request *http.Request, originalURI string, opts ...RequestOption) error { | ||
| return s.serveHTTP(responseWriter, request, originalURI, opts...) | ||
| } |
There was a problem hiding this comment.
not sure if we want to create a new public method, I'll leave that up to you
There was a problem hiding this comment.
the method itself serves two purposes though: for one we can get rid of the request allocation, second it enables getting rid of the request options slice copy every request as a follow-up.
There was a problem hiding this comment.
Why not just introducing a new Request Option?
There was a problem hiding this comment.
Primarily for the follow-up I intend. But let me see if I can work around that.
There was a problem hiding this comment.
Yeah, can work around it. Switched to request option instead.
69f8a32 to
0bebc4b
Compare
|
Maybe could we deprecate |
|
|
||
| // WithRequestOriginalURI sets REQUEST_URI to the original URI before rewrites. | ||
| // An empty URI falls back to the current request URL. | ||
| func WithRequestOriginalURI(originalURI string) RequestOption { |
There was a problem hiding this comment.
| func WithRequestOriginalURI(originalURI string) RequestOption { | |
| func WithOriginalRequestURI(uri string) RequestOption { |
?
|
|
||
| // WithRequestOriginalURI sets REQUEST_URI to the original URI before rewrites. | ||
| // An empty URI falls back to the current request URL. | ||
| func WithRequestOriginalURI(originalURI string) RequestOption { |
There was a problem hiding this comment.
I'd just call it WithRequestURI
There was a problem hiding this comment.
Wouldn't be clear since that could be the rewritten one.
|
Did |
You made me double check, and it's actually the closure that's returned that causes the heap copy. Might be acceptable to just take the string into a local and capture that in the closure, would be a 2 line change. |
1a5717d to
876d31a
Compare
instead of copying the full original request, just pass the original uri through as a string