elysiajs / eden

Fully type-safe Elysia client
MIT License
147 stars 37 forks source link

Eden Treaty V2 should not mutate the original paths array when making… #72

Closed MatthewAry closed 5 months ago

MatthewAry commented 5 months ago

… requests

See: https://discord.com/channels/1044804142461362206/1222687737098797116

Without this fix, you couldn't use the same treaty path object twice to execute requests. It would work the first time, but if tried to use it again, the request method would be lost.

This is because there was a mutation happening to the array used to contain the path information for the request, when really the mutation shouldn't be happening. A copy of the paths array is now created before extracting the method and construction the path string.