Skip to content

SetParam

Compare
Choose a tag to compare
@guregu guregu released this 10 Sep 18:43
· 11 commits to master since this release

Added kami.SetParam, this lets you change params you retrieve from kami.Param.

Params were never intended to be mutable, but this allows you to test handlers without running them through kami (see: #26).

If you use this in middleware or a request, it might have unintended consequences. Also, it isn't concurrency-safe. Please use it for setting up contexts for tests only.

I have experimented with making SetParam safe (safe-params branch) but it makes paths with lots of params slower and increases allocations.

If you have a use case for this, open an issue. However, I think it's a bad idea to mutate the params outside of testing.