I don't understand the difference between usage the inline function with r.Use and actually specifying the fucntion, but it has a different execution behaviour.
Finally, if inside the InvoiceCtx replace chi.URLParam(r, "invoiceNumber") usage with r.PathValue("invoiceNumber")
everything working as expected again.
Reading the release notes, I assume the issue might be introduced in 5.0.12
Here is the code to demostrate
Specifically the line
invoiceNumber := chi.URLParam(r, "invoiceNumber")
will work as expected.However, you can see the usage of
r.Use(h.InvoiceCtx)
where the same line of code is present - it will return""
emptry string every time.I don't understand the difference between usage the inline function with
r.Use
and actually specifying the fucntion, but it has a different execution behaviour.Finally, if inside the
InvoiceCtx
replacechi.URLParam(r, "invoiceNumber")
usage withr.PathValue("invoiceNumber")
everything working as expected again.